@@ -20,7 +20,9 @@ public function shouldPassGETRequestToClient()
20
20
->method ('get ' )
21
21
->with ('/path?param1=param1value ' , array ('header1 ' => 'header1value ' ))
22
22
->will ($ this ->returnValue ($ this ->getPSR7Response ($ expectedArray )));
23
- $ client = $ this ->getMock ('Github\Client ' , array ('getHttpClient ' ));
23
+ $ client = $ this ->getMockBuilder ('Github\Client ' )
24
+ ->setMethods (array ('getHttpClient ' ))
25
+ ->getMock ();
24
26
$ client ->expects ($ this ->any ())
25
27
->method ('getHttpClient ' )
26
28
->willReturn ($ httpClient );
@@ -44,7 +46,9 @@ public function shouldPassPOSTRequestToClient()
44
46
->with ('/path ' , array ('option1 ' => 'option1value ' ), json_encode (array ('param1 ' => 'param1value ' )))
45
47
->will ($ this ->returnValue ($ this ->getPSR7Response ($ expectedArray )));
46
48
47
- $ client = $ this ->getMock ('Github\Client ' , array ('getHttpClient ' ));
49
+ $ client = $ this ->getMockBuilder ('Github\Client ' )
50
+ ->setMethods (array ('getHttpClient ' ))
51
+ ->getMock ();
48
52
$ client ->expects ($ this ->any ())
49
53
->method ('getHttpClient ' )
50
54
->willReturn ($ httpClient );
@@ -68,7 +72,9 @@ public function shouldPassPATCHRequestToClient()
68
72
->with ('/path ' , array ('option1 ' => 'option1value ' ), json_encode (array ('param1 ' => 'param1value ' )))
69
73
->will ($ this ->returnValue ($ this ->getPSR7Response ($ expectedArray )));
70
74
71
- $ client = $ this ->getMock ('Github\Client ' , array ('getHttpClient ' ));
75
+ $ client = $ this ->getMockBuilder ('Github\Client ' )
76
+ ->setMethods (array ('getHttpClient ' ))
77
+ ->getMock ();
72
78
$ client ->expects ($ this ->any ())
73
79
->method ('getHttpClient ' )
74
80
->willReturn ($ httpClient );
@@ -92,7 +98,9 @@ public function shouldPassPUTRequestToClient()
92
98
->with ('/path ' , array ('option1 ' => 'option1value ' ), json_encode (array ('param1 ' => 'param1value ' )))
93
99
->will ($ this ->returnValue ($ this ->getPSR7Response ($ expectedArray )));
94
100
95
- $ client = $ this ->getMock ('Github\Client ' , array ('getHttpClient ' ));
101
+ $ client = $ this ->getMockBuilder ('Github\Client ' )
102
+ ->setMethods (array ('getHttpClient ' ))
103
+ ->getMock ();
96
104
$ client ->expects ($ this ->any ())
97
105
->method ('getHttpClient ' )
98
106
->willReturn ($ httpClient );
@@ -116,7 +124,9 @@ public function shouldPassDELETERequestToClient()
116
124
->with ('/path ' , array ('option1 ' => 'option1value ' ), json_encode (array ('param1 ' => 'param1value ' )))
117
125
->will ($ this ->returnValue ($ this ->getPSR7Response ($ expectedArray )));
118
126
119
- $ client = $ this ->getMock ('Github\Client ' , array ('getHttpClient ' ));
127
+ $ client = $ this ->getMockBuilder ('Github\Client ' )
128
+ ->setMethods (array ('getHttpClient ' ))
129
+ ->getMock ();
120
130
$ client ->expects ($ this ->any ())
121
131
->method ('getHttpClient ' )
122
132
->willReturn ($ httpClient );
@@ -141,7 +151,9 @@ public function shouldNotPassEmptyRefToClient()
141
151
->with ('/path ' , array ())
142
152
->will ($ this ->returnValue ($ this ->getPSR7Response ($ expectedArray )));
143
153
144
- $ client = $ this ->getMock ('Github\Client ' , array ('getHttpClient ' ));
154
+ $ client = $ this ->getMockBuilder ('Github\Client ' )
155
+ ->setMethods (array ('getHttpClient ' ))
156
+ ->getMock ();
145
157
$ client ->expects ($ this ->any ())
146
158
->method ('getHttpClient ' )
147
159
->willReturn ($ httpClient );
@@ -166,12 +178,16 @@ protected function getClientMock()
166
178
/**
167
179
* Return a HttpMethods client mock
168
180
*
181
+ * @param array $methods
169
182
* @return \Http\Client\Common\HttpMethodsClient
170
183
*/
171
184
protected function getHttpMethodsMock (array $ methods = array ())
172
185
{
173
186
$ methods = array_merge (array ('sendRequest ' ), $ methods );
174
- $ mock = $ this ->getMock ('Http\Client\Common\HttpMethodsClient ' , $ methods , array (), '' , false );
187
+ $ mock = $ this ->getMockBuilder ('Http\Client\Common\HttpMethodsClient ' )
188
+ ->disableOriginalConstructor ()
189
+ ->setMethods ($ methods )
190
+ ->getMock ();
175
191
$ mock
176
192
->expects ($ this ->any ())
177
193
->method ('sendRequest ' );
@@ -183,7 +199,9 @@ protected function getHttpMethodsMock(array $methods = array())
183
199
*/
184
200
protected function getHttpClientMock ()
185
201
{
186
- $ mock = $ this ->getMock ('Http\Client\HttpClient ' , array ('sendRequest ' ));
202
+ $ mock = $ this ->getMockBuilder ('Http\Client\HttpClient ' )
203
+ ->setMethods (array ('sendRequest ' ))
204
+ ->getMock ();
187
205
$ mock
188
206
->expects ($ this ->any ())
189
207
->method ('sendRequest ' );
0 commit comments