@@ -15,7 +15,7 @@ class ClientTest extends TestCase
15
15
/** @var array */
16
16
private $ headers ;
17
17
18
- protected function setUp ()
18
+ protected function setUp (): void
19
19
{
20
20
$ this ->host = 'https://localhost:4010 ' ;
21
21
$ this ->headers = [
@@ -27,13 +27,11 @@ protected function setUp()
27
27
28
28
public function testConstructor ()
29
29
{
30
- $ this ->assertAttributeEquals ($ this ->host , 'host ' , $ this ->client );
31
- $ this ->assertAttributeEquals ($ this ->headers , 'headers ' , $ this ->client );
32
- $ this ->assertAttributeEquals ('/v3 ' , 'version ' , $ this ->client );
33
- $ this ->assertAttributeEquals ([], 'path ' , $ this ->client );
34
- $ this ->assertAttributeEquals ([], 'curlOptions ' , $ this ->client );
35
- $ this ->assertAttributeEquals (false , 'retryOnLimit ' , $ this ->client );
36
- $ this ->assertAttributeEquals (['get ' , 'post ' , 'patch ' , 'put ' , 'delete ' ], 'methods ' , $ this ->client );
30
+ $ this ->assertEquals ($ this ->host , $ this ->client ->getHost ());
31
+ $ this ->assertEquals ($ this ->headers , $ this ->client ->getHeaders ());
32
+ $ this ->assertEquals ('/v3 ' , $ this ->client ->getVersion ());
33
+ $ this ->assertEquals ([], $ this ->client ->getPath ());
34
+ $ this ->assertEquals ([], $ this ->client ->getCurlOptions ());
37
35
}
38
36
39
37
public function test_ ()
@@ -42,34 +40,34 @@ public function test_()
42
40
$ client ->setCurlOptions (['foo ' => 'bar ' ]);
43
41
$ client = $ client ->_ ('test ' );
44
42
45
- $ this ->assertAttributeEquals (['test ' ], ' path ' , $ client );
46
- $ this ->assertAttributeEquals (['foo ' => 'bar ' ], ' curlOptions ' , $ client );
43
+ $ this ->assertEquals (['test ' ], $ client-> getPath () );
44
+ $ this ->assertEquals (['foo ' => 'bar ' ], $ client-> getCurlOptions () );
47
45
}
48
46
49
47
public function test__call ()
50
48
{
51
49
$ client = $ this ->client ->get ();
52
- $ this ->assertAttributeEquals ('https://localhost:4010/v3/ ' , ' url ' , $ client );
50
+ $ this ->assertEquals ('https://localhost:4010/v3/ ' , $ client-> url );
53
51
54
52
$ queryParams = ['limit ' => 100 , 'offset ' => 0 ];
55
53
$ client = $ this ->client ->get (null , $ queryParams );
56
- $ this ->assertAttributeEquals ('https://localhost:4010/v3/?limit=100&offset=0 ' , ' url ' , $ client );
54
+ $ this ->assertEquals ('https://localhost:4010/v3/?limit=100&offset=0 ' , $ client-> url );
57
55
58
56
$ requestBody = ['name ' => 'A New Hope ' ];
59
57
$ client = $ this ->client ->get ($ requestBody );
60
- $ this ->assertAttributeEquals ($ requestBody , ' requestBody ' , $ client );
58
+ $ this ->assertEquals ($ requestBody , $ client-> requestBody );
61
59
62
60
$ requestHeaders = ['X-Mock: 200 ' ];
63
61
$ client = $ this ->client ->get (null , null , $ requestHeaders );
64
- $ this ->assertAttributeEquals ($ requestHeaders , ' requestHeaders ' , $ client );
62
+ $ this ->assertEquals ($ requestHeaders , $ client-> requestHeaders );
65
63
66
64
$ client = $ this ->client ->version ('/v4 ' );
67
- $ this ->assertAttributeEquals ('/v4 ' , ' version ' , $ client );
65
+ $ this ->assertEquals ('/v4 ' , $ client-> getVersion () );
68
66
69
67
$ client = $ this ->client ->path_to_endpoint ();
70
- $ this ->assertAttributeEquals (['path_to_endpoint ' ], ' path ' , $ client );
68
+ $ this ->assertEquals (['path_to_endpoint ' ], $ client-> getPath () );
71
69
$ client = $ client ->one_more_segment ();
72
- $ this ->assertAttributeEquals (['path_to_endpoint ' , 'one_more_segment ' ], ' path ' , $ client );
70
+ $ this ->assertEquals (['path_to_endpoint ' , 'one_more_segment ' ], $ client-> getPath () );
73
71
}
74
72
75
73
public function testGetHost ()
@@ -212,7 +210,7 @@ public function testThrowExceptionOnInvalidCall()
212
210
public function testMakeRequestWithUntrustedRootCert ()
213
211
{
214
212
$ this ->expectException (InvalidRequest::class);
215
- $ this ->expectExceptionMessageRegExp ('/certificate/i ' );
213
+ $ this ->expectExceptionMessageMatches ('/certificate/i ' );
216
214
217
215
$ client = new Client ('https://untrusted-root.badssl.com/ ' );
218
216
$ client ->makeRequest ('GET ' , 'https://untrusted-root.badssl.com/ ' );
@@ -223,12 +221,12 @@ public function testFormRepeatUrlArgs()
223
221
$ client = new Client ('https://localhost:4010 ' );
224
222
225
223
$ testParams = [
226
- 'thing ' => 'stuff ' ,
227
- 'foo ' => [
228
- 'bar ' ,
229
- 'bat ' ,
230
- 'baz ' ,
231
- ],
224
+ 'thing ' => 'stuff ' ,
225
+ 'foo ' => [
226
+ 'bar ' ,
227
+ 'bat ' ,
228
+ 'baz ' ,
229
+ ],
232
230
];
233
231
$ result = $ this ->callMethod ($ client , 'buildUrl ' , [$ testParams ]);
234
232
$ this ->assertEquals ($ result , 'https://localhost:4010/?thing=stuff&foo=bar&foo=bat&foo=baz ' );
0 commit comments