Skip to content

Commit

Permalink
Merge pull request #542 from ciaranmcnulty/enums
Browse files Browse the repository at this point in the history
Test that doubling an Enum causes a sensible error
  • Loading branch information
ciaranmcnulty authored Sep 10, 2021
2 parents 8fb3150 + 5b13f7d commit 6582260
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
10 changes: 10 additions & 0 deletions fixtures/Enum.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace Fixtures\Prophecy;

enum Enum {
case Clubs;
case Diamonds;
case Hearts;
case Spades;
}
14 changes: 14 additions & 0 deletions tests/Doubler/Generator/ClassMirrorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,20 @@ public function it_can_double_never_return_type()

}

/**
* @test
*/
public function it_can_not_double_an_enum()
{
if (PHP_VERSION_ID < 80100) {
$this->markTestSkipped('Enums are not supported in this PHP version');
}

$this->expectException(ClassMirrorException::class);

$classNode = (new ClassMirror())->reflect(new \ReflectionClass('Fixtures\Prophecy\Enum'), []);
}

/**
* @test
*/
Expand Down

0 comments on commit 6582260

Please sign in to comment.