@@ -48,10 +48,10 @@ public function testCaseInsensitiveArraySet()
48
48
function assertions ($ array , $ count = 1 )
49
49
{
50
50
PHPUnit_Framework_Assert::assertCount ($ count , $ array );
51
- PHPUnit_Framework_Assert::assertTrue ($ array ['foo ' ] === 'bar ' );
52
- PHPUnit_Framework_Assert::assertTrue ($ array ['Foo ' ] === 'bar ' );
53
- PHPUnit_Framework_Assert::assertTrue ($ array ['FOo ' ] === 'bar ' );
54
- PHPUnit_Framework_Assert::assertTrue ($ array ['FOO ' ] === 'bar ' );
51
+ PHPUnit_Framework_Assert::assertEquals ($ array ['foo ' ], 'bar ' );
52
+ PHPUnit_Framework_Assert::assertEquals ($ array ['Foo ' ], 'bar ' );
53
+ PHPUnit_Framework_Assert::assertEquals ($ array ['FOo ' ], 'bar ' );
54
+ PHPUnit_Framework_Assert::assertEquals ($ array ['FOO ' ], 'bar ' );
55
55
}
56
56
57
57
$ array = new CaseInsensitiveArray ();
@@ -86,17 +86,17 @@ public function testUserAgent()
86
86
public function testGet ()
87
87
{
88
88
$ test = new Test ();
89
- $ this ->assertTrue ($ test ->server ('server ' , 'GET ' , array (
89
+ $ this ->assertEquals ($ test ->server ('server ' , 'GET ' , array (
90
90
'key ' => 'REQUEST_METHOD ' ,
91
- )) === 'GET ' );
91
+ )), 'GET ' );
92
92
}
93
93
94
94
public function testPostRequestMethod ()
95
95
{
96
96
$ test = new Test ();
97
- $ this ->assertTrue ($ test ->server ('server ' , 'POST ' , array (
97
+ $ this ->assertEquals ($ test ->server ('server ' , 'POST ' , array (
98
98
'key ' => 'REQUEST_METHOD ' ,
99
- )) === 'POST ' );
99
+ )), 'POST ' );
100
100
}
101
101
102
102
public function testPostContinueResponse ()
@@ -136,15 +136,15 @@ public function testPostContinueResponse()
136
136
public function testPostData ()
137
137
{
138
138
$ test = new Test ();
139
- $ this ->assertTrue ($ test ->server ('post ' , 'POST ' , array (
139
+ $ this ->assertEquals ($ test ->server ('post ' , 'POST ' , array (
140
140
'key ' => 'value ' ,
141
- )) === 'key=value ' );
141
+ )), 'key=value ' );
142
142
}
143
143
144
144
public function testPostAssociativeArrayData ()
145
145
{
146
146
$ test = new Test ();
147
- $ this ->assertTrue (
147
+ $ this ->assertEquals (
148
148
$ test ->server ('post_multidimensional ' , 'POST ' , array (
149
149
'username ' => 'myusername ' ,
150
150
'password ' => 'mypassword ' ,
@@ -154,7 +154,7 @@ public function testPostAssociativeArrayData()
154
154
'param3 ' => 123 ,
155
155
'param4 ' => 3.14 ,
156
156
),
157
- )) ===
157
+ )),
158
158
'username=myusername ' .
159
159
'&password=mypassword ' .
160
160
'&more_data%5B ' .
@@ -168,25 +168,25 @@ public function testPostAssociativeArrayData()
168
168
public function testPostMultidimensionalData ()
169
169
{
170
170
$ test = new Test ();
171
- $ this ->assertTrue ($ test ->server ('post_multidimensional ' , 'POST ' , array (
171
+ $ this ->assertEquals ($ test ->server ('post_multidimensional ' , 'POST ' , array (
172
172
'key ' => 'file ' ,
173
173
'file ' => array (
174
174
'wibble ' ,
175
175
'wubble ' ,
176
176
'wobble ' ,
177
177
),
178
- )) === 'key=file&file%5B%5D=wibble&file%5B%5D=wubble&file%5B%5D=wobble ' );
178
+ )), 'key=file&file%5B%5D=wibble&file%5B%5D=wubble&file%5B%5D=wobble ' );
179
179
}
180
180
181
181
public function testPostFilePathUpload ()
182
182
{
183
183
$ file_path = Helper \get_png ();
184
184
185
185
$ test = new Test ();
186
- $ this ->assertTrue ($ test ->server ('post_file_path_upload ' , 'POST ' , array (
186
+ $ this ->assertEquals ($ test ->server ('post_file_path_upload ' , 'POST ' , array (
187
187
'key ' => 'image ' ,
188
188
'image ' => '@ ' . $ file_path ,
189
- )) === 'image/png ' );
189
+ )), 'image/png ' );
190
190
191
191
unlink ($ file_path );
192
192
$ this ->assertFalse (file_exists ($ file_path ));
@@ -198,10 +198,10 @@ public function testPostCurlFileUpload()
198
198
$ file_path = Helper \get_png ();
199
199
200
200
$ test = new Test ();
201
- $ this ->assertTrue ($ test ->server ('post_file_path_upload ' , 'POST ' , array (
201
+ $ this ->assertEquals ($ test ->server ('post_file_path_upload ' , 'POST ' , array (
202
202
'key ' => 'image ' ,
203
203
'image ' => new CURLFile ($ file_path ),
204
- )) === 'image/png ' );
204
+ )), 'image/png ' );
205
205
206
206
unlink ($ file_path );
207
207
$ this ->assertFalse (file_exists ($ file_path ));
@@ -211,15 +211,15 @@ public function testPostCurlFileUpload()
211
211
public function testPutRequestMethod ()
212
212
{
213
213
$ test = new Test ();
214
- $ this ->assertTrue ($ test ->server ('request_method ' , 'PUT ' ) === 'PUT ' );
214
+ $ this ->assertEquals ($ test ->server ('request_method ' , 'PUT ' ), 'PUT ' );
215
215
}
216
216
217
217
public function testPutData ()
218
218
{
219
219
$ test = new Test ();
220
- $ this ->assertTrue ($ test ->server ('put ' , 'PUT ' , array (
220
+ $ this ->assertEquals ($ test ->server ('put ' , 'PUT ' , array (
221
221
'key ' => 'value ' ,
222
- )) === 'key=value ' );
222
+ )), 'key=value ' );
223
223
}
224
224
225
225
public function testPutFileHandle ()
@@ -236,27 +236,27 @@ public function testPutFileHandle()
236
236
237
237
fclose ($ tmp_file );
238
238
239
- $ this ->assertTrue ($ test ->curl ->response === 'image/png ' );
239
+ $ this ->assertEquals ($ test ->curl ->response , 'image/png ' );
240
240
}
241
241
242
242
public function testPatchRequestMethod ()
243
243
{
244
244
$ test = new Test ();
245
- $ this ->assertTrue ($ test ->server ('request_method ' , 'PATCH ' ) === 'PATCH ' );
245
+ $ this ->assertEquals ($ test ->server ('request_method ' , 'PATCH ' ), 'PATCH ' );
246
246
}
247
247
248
248
public function testDelete ()
249
249
{
250
250
$ test = new Test ();
251
- $ this ->assertTrue ($ test ->server ('server ' , 'DELETE ' , array (
251
+ $ this ->assertEquals ($ test ->server ('server ' , 'DELETE ' , array (
252
252
'key ' => 'REQUEST_METHOD ' ,
253
- )) === 'DELETE ' );
253
+ )), 'DELETE ' );
254
254
255
255
$ test = new Test ();
256
- $ this ->assertTrue ($ test ->server ('delete ' , 'DELETE ' , array (
256
+ $ this ->assertEquals ($ test ->server ('delete ' , 'DELETE ' , array (
257
257
'test ' => 'delete ' ,
258
258
'key ' => 'test ' ,
259
- )) === 'delete ' );
259
+ )), 'delete ' );
260
260
}
261
261
262
262
public function testHeadRequestMethod ()
@@ -281,7 +281,7 @@ public function testOptionsRequestMethod()
281
281
public function testBasicHttpAuth401Unauthorized ()
282
282
{
283
283
$ test = new Test ();
284
- $ this ->assertTrue ($ test ->server ('http_basic_auth ' , 'GET ' ) === 'canceled ' );
284
+ $ this ->assertEquals ($ test ->server ('http_basic_auth ' , 'GET ' ), 'canceled ' );
285
285
}
286
286
287
287
public function testBasicHttpAuthSuccess ()
@@ -292,17 +292,17 @@ public function testBasicHttpAuthSuccess()
292
292
$ test ->curl ->setBasicAuthentication ($ username , $ password );
293
293
$ test ->server ('http_basic_auth ' , 'GET ' );
294
294
$ json = $ test ->curl ->response ;
295
- $ this ->assertTrue ($ json ->username === $ username );
296
- $ this ->assertTrue ($ json ->password === $ password );
295
+ $ this ->assertEquals ($ json ->username , $ username );
296
+ $ this ->assertEquals ($ json ->password , $ password );
297
297
}
298
298
299
299
public function testReferrer ()
300
300
{
301
301
$ test = new Test ();
302
302
$ test ->curl ->setReferrer ('myreferrer ' );
303
- $ this ->assertTrue ($ test ->server ('server ' , 'GET ' , array (
303
+ $ this ->assertEquals ($ test ->server ('server ' , 'GET ' , array (
304
304
'key ' => 'HTTP_REFERER ' ,
305
- )) === 'myreferrer ' );
305
+ )), 'myreferrer ' );
306
306
}
307
307
308
308
public function testResponseBody ()
@@ -318,17 +318,17 @@ public function testResponseBody()
318
318
) as $ request_method => $ expected_response ) {
319
319
$ curl = new Curl ();
320
320
$ curl ->setHeader ('X-DEBUG-TEST ' , 'response_body ' );
321
- $ this ->assertTrue ($ curl ->$ request_method (Test::TEST_URL ) === $ expected_response );
321
+ $ this ->assertEquals ($ curl ->$ request_method (Test::TEST_URL ), $ expected_response );
322
322
}
323
323
}
324
324
325
325
public function testCookies ()
326
326
{
327
327
$ test = new Test ();
328
328
$ test ->curl ->setCookie ('mycookie ' , 'yum ' );
329
- $ this ->assertTrue ($ test ->server ('cookie ' , 'GET ' , array (
329
+ $ this ->assertEquals ($ test ->server ('cookie ' , 'GET ' , array (
330
330
'key ' => 'mycookie ' ,
331
- )) === 'yum ' );
331
+ )), 'yum ' );
332
332
}
333
333
334
334
public function testCookieEncoding ()
@@ -359,9 +359,9 @@ public function testCookieFile()
359
359
360
360
$ test = new Test ();
361
361
$ test ->curl ->setCookieFile ($ cookie_file );
362
- $ this ->assertTrue ($ test ->server ('cookie ' , 'GET ' , array (
362
+ $ this ->assertEquals ($ test ->server ('cookie ' , 'GET ' , array (
363
363
'key ' => 'mycookie ' ,
364
- )) === 'yum ' );
364
+ )), 'yum ' );
365
365
366
366
unlink ($ cookie_file );
367
367
$ this ->assertFalse (file_exists ($ cookie_file ));
@@ -402,7 +402,7 @@ public function testError()
402
402
$ test ->curl ->get (Test::ERROR_URL );
403
403
$ this ->assertTrue ($ test ->curl ->error );
404
404
$ this ->assertTrue ($ test ->curl ->curl_error );
405
- $ this ->assertTrue ($ test ->curl ->curl_error_code === CURLE_OPERATION_TIMEOUTED );
405
+ $ this ->assertEquals ($ test ->curl ->curl_error_code , CURLE_OPERATION_TIMEOUTED );
406
406
}
407
407
408
408
public function testErrorMessage ()
@@ -424,15 +424,15 @@ public function testHeaders()
424
424
$ test ->curl ->setHeader ('Content-Type ' , 'application/json ' );
425
425
$ test ->curl ->setHeader ('X-Requested-With ' , 'XMLHttpRequest ' );
426
426
$ test ->curl ->setHeader ('Accept ' , 'application/json ' );
427
- $ this ->assertTrue ($ test ->server ('server ' , 'GET ' , array (
427
+ $ this ->assertEquals ($ test ->server ('server ' , 'GET ' , array (
428
428
'key ' => 'CONTENT_TYPE ' ,
429
- )) === 'application/json ' );
430
- $ this ->assertTrue ($ test ->server ('server ' , 'GET ' , array (
429
+ )), 'application/json ' );
430
+ $ this ->assertEquals ($ test ->server ('server ' , 'GET ' , array (
431
431
'key ' => 'HTTP_X_REQUESTED_WITH ' ,
432
- )) === 'XMLHttpRequest ' );
433
- $ this ->assertTrue ($ test ->server ('server ' , 'GET ' , array (
432
+ )), 'XMLHttpRequest ' );
433
+ $ this ->assertEquals ($ test ->server ('server ' , 'GET ' , array (
434
434
'key ' => 'HTTP_ACCEPT ' ,
435
- )) === 'application/json ' );
435
+ )), 'application/json ' );
436
436
}
437
437
438
438
public function testHeaderCaseSensitivity ()
@@ -494,9 +494,7 @@ public function testNestedData()
494
494
),
495
495
),
496
496
);
497
- $ this ->assertTrue (
498
- $ test ->server ('post ' , 'POST ' , $ data ) === http_build_query ($ data )
499
- );
497
+ $ this ->assertEquals ($ test ->server ('post ' , 'POST ' , $ data ), http_build_query ($ data ));
500
498
}
501
499
502
500
public function testPostStringUrlEncodedContentType ()
@@ -679,7 +677,7 @@ public function testArrayToStringConversion()
679
677
'baz ' => array (
680
678
),
681
679
));
682
- $ this ->assertTrue ($ test ->curl ->response === 'foo=bar&baz= ' );
680
+ $ this ->assertEquals ($ test ->curl ->response , 'foo=bar&baz= ' );
683
681
684
682
$ test = new Test ();
685
683
$ test ->server ('post ' , 'POST ' , array (
@@ -689,10 +687,7 @@ public function testArrayToStringConversion()
689
687
),
690
688
),
691
689
));
692
- $ this ->assertTrue (
693
- urldecode ($ test ->curl ->response ) ===
694
- 'foo=bar&baz[qux]= '
695
- );
690
+ $ this ->assertEquals (urldecode ($ test ->curl ->response ), 'foo=bar&baz[qux]= ' );
696
691
697
692
$ test = new Test ();
698
693
$ test ->server ('post ' , 'POST ' , array (
@@ -703,10 +698,7 @@ public function testArrayToStringConversion()
703
698
'wibble ' => 'wobble ' ,
704
699
),
705
700
));
706
- $ this ->assertTrue (
707
- urldecode ($ test ->curl ->response ) ===
708
- 'foo=bar&baz[qux]=&baz[wibble]=wobble '
709
- );
701
+ $ this ->assertEquals (urldecode ($ test ->curl ->response ), 'foo=bar&baz[qux]=&baz[wibble]=wobble ' );
710
702
}
711
703
712
704
public function testParallelRequests ()
@@ -725,9 +717,9 @@ public function testParallelRequests()
725
717
));
726
718
727
719
$ len = strlen ('/a/?foo=bar ' );
728
- $ this ->assertTrue (substr ($ curl ->curls ['0 ' ]->response , - $ len ) === '/a/?foo=bar ' );
729
- $ this ->assertTrue (substr ($ curl ->curls ['1 ' ]->response , - $ len ) === '/b/?foo=bar ' );
730
- $ this ->assertTrue (substr ($ curl ->curls ['2 ' ]->response , - $ len ) === '/c/?foo=bar ' );
720
+ $ this ->assertEquals (substr ($ curl ->curls ['0 ' ]->response , - $ len ), '/a/?foo=bar ' );
721
+ $ this ->assertEquals (substr ($ curl ->curls ['1 ' ]->response , - $ len ), '/b/?foo=bar ' );
722
+ $ this ->assertEquals (substr ($ curl ->curls ['2 ' ]->response , - $ len ), '/c/?foo=bar ' );
731
723
}
732
724
733
725
public function testParallelRequestErrors ()
@@ -738,7 +730,7 @@ public function testParallelRequestErrors()
738
730
$ curl ->complete (function ($ instance ) use (&$ success_called , &$ error_called , &$ complete_called ) {
739
731
PHPUnit_Framework_Assert::assertTrue ($ instance ->error );
740
732
PHPUnit_Framework_Assert::assertTrue ($ instance ->curl_error );
741
- PHPUnit_Framework_Assert::assertTrue ($ instance ->curl_error_code === CURLE_OPERATION_TIMEOUTED );
733
+ PHPUnit_Framework_Assert::assertEquals ($ instance ->curl_error_code , CURLE_OPERATION_TIMEOUTED );
742
734
});
743
735
$ curl ->get (array (
744
736
Test::ERROR_URL . 'a/ ' ,
@@ -754,7 +746,7 @@ public function testParallelSetOptions()
754
746
$ curl ->setHeader ('X-DEBUG-TEST ' , 'server ' );
755
747
$ curl ->setOpt (CURLOPT_USERAGENT , 'useragent ' );
756
748
$ curl ->complete (function ($ instance ) {
757
- PHPUnit_Framework_Assert::assertTrue ($ instance ->response === 'useragent ' );
749
+ PHPUnit_Framework_Assert::assertEquals ($ instance ->response , 'useragent ' );
758
750
});
759
751
$ curl ->get (array (
760
752
Test::TEST_URL ,
0 commit comments