22
33namespace phpmock \phpunit ;
44
5+ use PHPUnit \Framework \MockObject \Matcher \MethodName ;
6+ use PHPUnit \Framework \MockObject \Stub \MatcherCollection ;
57use PHPUnit \Framework \TestCase ;
68use phpmock \integration \MockDelegateFunctionBuilder ;
79use PHPUnit \Framework \MockObject \Builder \InvocationMocker ;
@@ -29,9 +31,11 @@ public function testExpects()
2931 {
3032 $ matcher = $ this ->getMockBuilder (Invocation::class)->getMock ();
3133
32- $ invocationMocker = $ this ->getMockBuilder (InvocationMocker::class)->disableOriginalConstructor ()->getMock ();
33- $ invocationMocker ->expects ($ this ->once ())->method ("method " )
34- ->with (MockDelegateFunctionBuilder::METHOD )->willReturn ($ invocationMocker );
34+ $ invocationMocker = new InvocationMocker (
35+ $ this ->prophesize (MatcherCollection::class)->reveal (),
36+ $ this ->prophesize (Invocation::class)->reveal (),
37+ [MockDelegateFunctionBuilder::METHOD ]
38+ );
3539
3640 $ prophecy = $ this ->prophesize (MockObject::class);
3741 $ prophecy ->expects ($ matcher )->willReturn ($ invocationMocker );
@@ -41,6 +45,11 @@ public function testExpects()
4145
4246 $ result = $ proxy ->expects ($ matcher );
4347 $ this ->assertEquals ($ invocationMocker , $ result );
48+
49+ $ this ->assertSame (
50+ (new MethodName (MockDelegateFunctionBuilder::METHOD ))->toString (),
51+ ($ invocationMocker ->getMatcher ()->methodNameMatcher ?? $ invocationMocker ->getMatcher ()->getMethodNameMatcher ())->toString ()
52+ );
4453 }
4554
4655 /**
0 commit comments