@@ -30,10 +30,7 @@ public function testDispatchQueries(): void
30
30
$ reverseQuery = ReverseQuery::fromCoordinates (47 , 11 );
31
31
$ collection = new AddressCollection ([]);
32
32
33
- $ provider = $ this ->getMockBuilder (Provider::class)
34
- ->disableOriginalConstructor ()
35
- ->setMethods (['geocodeQuery ' , 'reverseQuery ' , 'getName ' ])
36
- ->getMock ();
33
+ $ provider = $ this ->createPartialMock (Provider::class, ['geocodeQuery ' , 'reverseQuery ' , 'getName ' ]);
37
34
$ provider ->expects ($ this ->once ())
38
35
->method ('geocodeQuery ' )
39
36
->with ($ geocodeQuery )
@@ -54,21 +51,15 @@ public function testPluginsIsBeingUsedWhenGeocoding(): void
54
51
$ geocodeQuery = GeocodeQuery::create ('foo ' );
55
52
$ collection = new AddressCollection ([]);
56
53
57
- $ provider = $ this ->getMockBuilder (Provider::class)
58
- ->disableOriginalConstructor ()
59
- ->setMethods (['geocodeQuery ' , 'reverseQuery ' , 'getName ' ])
60
- ->getMock ();
54
+ $ provider = $ this ->createPartialMock (Provider::class, ['geocodeQuery ' , 'reverseQuery ' , 'getName ' ]);
61
55
$ provider ->expects ($ this ->once ())
62
56
->method ('geocodeQuery ' )
63
57
->with ($ geocodeQuery )
64
58
->willReturn ($ collection );
65
59
$ provider ->expects ($ this ->never ())->method ('reverseQuery ' );
66
60
$ provider ->expects ($ this ->never ())->method ('getName ' );
67
61
68
- $ pluginA = $ this ->getMockBuilder (Plugin::class)
69
- ->disableOriginalConstructor ()
70
- ->setMethods (['handleQuery ' ])
71
- ->getMock ();
62
+ $ pluginA = $ this ->createPartialMock (Plugin::class, ['handleQuery ' ]);
72
63
$ pluginA ->expects ($ this ->once ())
73
64
->method ('handleQuery ' )
74
65
->with ($ geocodeQuery , $ this ->isType ('callable ' ), $ this ->isType ('callable ' ))
@@ -85,21 +76,15 @@ public function testPluginsIsBeingUsedWhenReverse(): void
85
76
$ reverseQuery = ReverseQuery::fromCoordinates (47 , 11 );
86
77
$ collection = new AddressCollection ([]);
87
78
88
- $ provider = $ this ->getMockBuilder (Provider::class)
89
- ->disableOriginalConstructor ()
90
- ->setMethods (['geocodeQuery ' , 'reverseQuery ' , 'getName ' ])
91
- ->getMock ();
79
+ $ provider = $ this ->createPartialMock (Provider::class, ['geocodeQuery ' , 'reverseQuery ' , 'getName ' ]);
92
80
$ provider ->expects ($ this ->never ())->method ('geocodeQuery ' );
93
81
$ provider ->expects ($ this ->never ())->method ('getName ' );
94
82
$ provider ->expects ($ this ->once ())
95
83
->method ('reverseQuery ' )
96
84
->with ($ reverseQuery )
97
85
->willReturn ($ collection );
98
86
99
- $ pluginA = $ this ->getMockBuilder (Plugin::class)
100
- ->disableOriginalConstructor ()
101
- ->setMethods (['handleQuery ' ])
102
- ->getMock ();
87
+ $ pluginA = $ this ->createPartialMock (Plugin::class, ['handleQuery ' ]);
103
88
$ pluginA ->expects ($ this ->once ())
104
89
->method ('handleQuery ' )
105
90
->with ($ reverseQuery , $ this ->isType ('callable ' ), $ this ->isType ('callable ' ))
@@ -116,28 +101,19 @@ public function testLoopException(): void
116
101
$ this ->expectException (LoopException::class);
117
102
$ geocodeQuery = GeocodeQuery::create ('foo ' );
118
103
119
- $ provider = $ this ->getMockBuilder (Provider::class)
120
- ->disableOriginalConstructor ()
121
- ->setMethods (['geocodeQuery ' , 'reverseQuery ' , 'getName ' ])
122
- ->getMock ();
104
+ $ provider = $ this ->createPartialMock (Provider::class, ['geocodeQuery ' , 'reverseQuery ' , 'getName ' ]);
123
105
$ provider ->expects ($ this ->never ())->method ('geocodeQuery ' );
124
106
$ provider ->expects ($ this ->never ())->method ('reverseQuery ' );
125
107
$ provider ->expects ($ this ->never ())->method ('getName ' );
126
108
127
- $ pluginA = $ this ->getMockBuilder (Plugin::class)
128
- ->disableOriginalConstructor ()
129
- ->setMethods (['handleQuery ' ])
130
- ->getMock ();
109
+ $ pluginA = $ this ->createPartialMock (Plugin::class, ['handleQuery ' ]);
131
110
$ pluginA ->expects ($ this ->any ())
132
111
->method ('handleQuery ' )
133
112
->with ($ geocodeQuery , $ this ->isType ('callable ' ), $ this ->isType ('callable ' ))
134
113
->willReturnCallback (function (Query $ query , callable $ next , callable $ first ) {
135
114
return $ next ($ query );
136
115
});
137
- $ pluginB = $ this ->getMockBuilder (Plugin::class)
138
- ->disableOriginalConstructor ()
139
- ->setMethods (['handleQuery ' ])
140
- ->getMock ();
116
+ $ pluginB = $ this ->createPartialMock (Plugin::class, ['handleQuery ' ]);
141
117
$ pluginB ->expects ($ this ->any ())
142
118
->method ('handleQuery ' )
143
119
->with ($ geocodeQuery , $ this ->isType ('callable ' ), $ this ->isType ('callable ' ))
0 commit comments