@@ -30,10 +30,7 @@ public function testDispatchQueries(): void
3030 $ reverseQuery = ReverseQuery::fromCoordinates (47 , 11 );
3131 $ collection = new AddressCollection ([]);
3232
33- $ provider = $ this ->getMockBuilder (Provider::class)
34- ->disableOriginalConstructor ()
35- ->setMethods (['geocodeQuery ' , 'reverseQuery ' , 'getName ' ])
36- ->getMock ();
33+ $ provider = $ this ->createPartialMock (Provider::class, ['geocodeQuery ' , 'reverseQuery ' , 'getName ' ]);
3734 $ provider ->expects ($ this ->once ())
3835 ->method ('geocodeQuery ' )
3936 ->with ($ geocodeQuery )
@@ -54,21 +51,15 @@ public function testPluginsIsBeingUsedWhenGeocoding(): void
5451 $ geocodeQuery = GeocodeQuery::create ('foo ' );
5552 $ collection = new AddressCollection ([]);
5653
57- $ provider = $ this ->getMockBuilder (Provider::class)
58- ->disableOriginalConstructor ()
59- ->setMethods (['geocodeQuery ' , 'reverseQuery ' , 'getName ' ])
60- ->getMock ();
54+ $ provider = $ this ->createPartialMock (Provider::class, ['geocodeQuery ' , 'reverseQuery ' , 'getName ' ]);
6155 $ provider ->expects ($ this ->once ())
6256 ->method ('geocodeQuery ' )
6357 ->with ($ geocodeQuery )
6458 ->willReturn ($ collection );
6559 $ provider ->expects ($ this ->never ())->method ('reverseQuery ' );
6660 $ provider ->expects ($ this ->never ())->method ('getName ' );
6761
68- $ pluginA = $ this ->getMockBuilder (Plugin::class)
69- ->disableOriginalConstructor ()
70- ->setMethods (['handleQuery ' ])
71- ->getMock ();
62+ $ pluginA = $ this ->createPartialMock (Plugin::class, ['handleQuery ' ]);
7263 $ pluginA ->expects ($ this ->once ())
7364 ->method ('handleQuery ' )
7465 ->with ($ geocodeQuery , $ this ->isType ('callable ' ), $ this ->isType ('callable ' ))
@@ -85,21 +76,15 @@ public function testPluginsIsBeingUsedWhenReverse(): void
8576 $ reverseQuery = ReverseQuery::fromCoordinates (47 , 11 );
8677 $ collection = new AddressCollection ([]);
8778
88- $ provider = $ this ->getMockBuilder (Provider::class)
89- ->disableOriginalConstructor ()
90- ->setMethods (['geocodeQuery ' , 'reverseQuery ' , 'getName ' ])
91- ->getMock ();
79+ $ provider = $ this ->createPartialMock (Provider::class, ['geocodeQuery ' , 'reverseQuery ' , 'getName ' ]);
9280 $ provider ->expects ($ this ->never ())->method ('geocodeQuery ' );
9381 $ provider ->expects ($ this ->never ())->method ('getName ' );
9482 $ provider ->expects ($ this ->once ())
9583 ->method ('reverseQuery ' )
9684 ->with ($ reverseQuery )
9785 ->willReturn ($ collection );
9886
99- $ pluginA = $ this ->getMockBuilder (Plugin::class)
100- ->disableOriginalConstructor ()
101- ->setMethods (['handleQuery ' ])
102- ->getMock ();
87+ $ pluginA = $ this ->createPartialMock (Plugin::class, ['handleQuery ' ]);
10388 $ pluginA ->expects ($ this ->once ())
10489 ->method ('handleQuery ' )
10590 ->with ($ reverseQuery , $ this ->isType ('callable ' ), $ this ->isType ('callable ' ))
@@ -116,28 +101,19 @@ public function testLoopException(): void
116101 $ this ->expectException (LoopException::class);
117102 $ geocodeQuery = GeocodeQuery::create ('foo ' );
118103
119- $ provider = $ this ->getMockBuilder (Provider::class)
120- ->disableOriginalConstructor ()
121- ->setMethods (['geocodeQuery ' , 'reverseQuery ' , 'getName ' ])
122- ->getMock ();
104+ $ provider = $ this ->createPartialMock (Provider::class, ['geocodeQuery ' , 'reverseQuery ' , 'getName ' ]);
123105 $ provider ->expects ($ this ->never ())->method ('geocodeQuery ' );
124106 $ provider ->expects ($ this ->never ())->method ('reverseQuery ' );
125107 $ provider ->expects ($ this ->never ())->method ('getName ' );
126108
127- $ pluginA = $ this ->getMockBuilder (Plugin::class)
128- ->disableOriginalConstructor ()
129- ->setMethods (['handleQuery ' ])
130- ->getMock ();
109+ $ pluginA = $ this ->createPartialMock (Plugin::class, ['handleQuery ' ]);
131110 $ pluginA ->expects ($ this ->any ())
132111 ->method ('handleQuery ' )
133112 ->with ($ geocodeQuery , $ this ->isType ('callable ' ), $ this ->isType ('callable ' ))
134113 ->willReturnCallback (function (Query $ query , callable $ next , callable $ first ) {
135114 return $ next ($ query );
136115 });
137- $ pluginB = $ this ->getMockBuilder (Plugin::class)
138- ->disableOriginalConstructor ()
139- ->setMethods (['handleQuery ' ])
140- ->getMock ();
116+ $ pluginB = $ this ->createPartialMock (Plugin::class, ['handleQuery ' ]);
141117 $ pluginB ->expects ($ this ->any ())
142118 ->method ('handleQuery ' )
143119 ->with ($ geocodeQuery , $ this ->isType ('callable ' ), $ this ->isType ('callable ' ))
0 commit comments