Skip to content

Commit

Permalink
revert comment out (reason of comment outed is that not asserted Gene…
Browse files Browse the repository at this point in the history
…ricObjectType will be reported as method not found)
  • Loading branch information
sasezaki committed Nov 20, 2024
1 parent cb3a9c7 commit 7061ef1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,14 @@ public function getTypeFromMethodCall(
$className = $scope->getClassReflection()->getName();
}

assert(get_class($calledOnType) === Type\Generic\GenericObjectType::class);

return new Type\Generic\GenericObjectType(
Prophecy\ObjectProphecy::class,
[
Type\TypeCombinator::intersect(
new Type\ObjectType($className),
//...$calledOnType->templ
...$calledOnType->getTypes(),
),
],
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,21 @@ public function testCreateProphecyInTestMethod(): void
{
$prophecy = $this->prophesize(Src\Foo::class)->willImplement(Src\Bar::class);

$prophecy
->foo()
->shouldBeCalled()
->willReturn('foo');

$prophecy
->bar()
->shouldBeCalled()
->willReturn('Oh');

$subject = new Src\BaseModel();

self::assertSame('Oh', $subject->bar($prophecy->reveal()));
$fooBar = $prophecy->reveal();
self::assertSame('foo', $fooBar->foo());
self::assertSame('Oh', $subject->bar($fooBar));
}

public function testCreateProphecyInHelperMethod(): void
Expand Down

0 comments on commit 7061ef1

Please sign in to comment.