Skip to content

Commit

Permalink
Use PHP's reflection to get stub object, instead of prophesize() call
Browse files Browse the repository at this point in the history
  • Loading branch information
sasezaki committed Nov 16, 2024
1 parent 03bd022 commit 315866a
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions test/Unit/Reflection/ObjectProphecy/MethodReflectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,26 @@ final class MethodReflectionTest extends Framework\TestCase
{
public function testConstructorSetsValues(): void
{
$classReflection = $this->prophesize(Reflection\ClassReflection::class);
$classReflection = (new \ReflectionClass(Reflection\ClassReflection::class))
->newInstanceWithoutConstructor();
$name = 'hmm';

$reflection = new MethodReflection(
$classReflection->reveal(),
$classReflection,
$name
);

self::assertSame($classReflection->reveal(), $reflection->getDeclaringClass());
self::assertSame($classReflection, $reflection->getDeclaringClass());
self::assertSame($name, $reflection->getName());
}

public function testDefaults(): void
{
$classReflection = (new \ReflectionClass(Reflection\ClassReflection::class))
->newInstanceWithoutConstructor();

$reflection = new MethodReflection(
$this->prophesize(Reflection\ClassReflection::class)->reveal(),
$classReflection,
'hmm'
);

Expand Down

0 comments on commit 315866a

Please sign in to comment.