Skip to content

Commit

Permalink
Merge pull request #603 from stof/implement_double_interface
Browse files Browse the repository at this point in the history
Implement the DoubleInterface on double classes
  • Loading branch information
stof committed Jun 20, 2023
2 parents b8c65e1 + a0c5305 commit 66e10e9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Prophecy/Doubler/Doubler.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ protected function createDoubleClass(ReflectionClass $class = null, array $inter
$patch->apply($node);
}
}
$node->addInterface(DoubleInterface::class);

$this->creator->create($name, $node);

Expand Down
24 changes: 24 additions & 0 deletions tests/FunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
namespace Tests\Prophecy;

use PHPUnit\Framework\TestCase;
use Prophecy\Doubler\DoubleInterface;
use Prophecy\Prophecy\ProphecySubjectInterface;
use Prophecy\Prophet;

class FunctionalTest extends TestCase
Expand All @@ -23,4 +25,26 @@ public function case_insensitive_method_names()
self::assertSame(2, $arrayObject->offsetGet(2));
self::assertSame(3, $arrayObject->offsetGet(3));
}

/**
* @test
*/
public function it_implements_the_double_interface()
{
$prophet = new Prophet();
$object = $prophet->prophesize('stdClass')->reveal();

$this->assertInstanceOf(DoubleInterface::class, $object);
}

/**
* @test
*/
public function it_implements_the_prophecy_subject_interface()
{
$prophet = new Prophet();
$object = $prophet->prophesize('stdClass')->reveal();

$this->assertInstanceOf(ProphecySubjectInterface::class, $object);
}
}

0 comments on commit 66e10e9

Please sign in to comment.