@@ -1016,7 +1016,7 @@ public function testSetCookieString()
1016
1016
1017
1017
public function testCookieFile ()
1018
1018
{
1019
- $ cookie_file = dirname (__FILE__ ) . '/cookies .txt ' ;
1019
+ $ cookie_file = dirname (__FILE__ ) . '/cookiefile .txt ' ;
1020
1020
$ cookie_data = implode ("\t" , array (
1021
1021
'127.0.0.1 ' , // domain
1022
1022
'FALSE ' , // tailmatch
@@ -1029,27 +1029,25 @@ public function testCookieFile()
1029
1029
file_put_contents ($ cookie_file , $ cookie_data );
1030
1030
1031
1031
$ test = new Test ();
1032
- $ test ->curl ->setCookieFile ($ cookie_file );
1033
- $ this ->assertEquals ('yum ' , $ test ->server ('cookie ' , 'GET ' , array (
1034
- 'key ' => 'mycookie ' ,
1035
- )));
1032
+ $ test ->curl ->setOpt (CURLOPT_COOKIEFILE , $ cookie_file );
1033
+ $ this ->assertEquals ($ cookie_data , file_get_contents ($ test ->curl ->getOpt (CURLOPT_COOKIEFILE )));
1036
1034
1037
1035
unlink ($ cookie_file );
1038
1036
$ this ->assertFalse (file_exists ($ cookie_file ));
1039
1037
}
1040
1038
1041
1039
public function testCookieJar ()
1042
1040
{
1043
- $ cookie_file = dirname (__FILE__ ) . '/cookies .txt ' ;
1041
+ $ cookie_jar = dirname (__FILE__ ) . '/cookiejar .txt ' ;
1044
1042
1045
1043
$ test = new Test ();
1046
- $ test ->curl ->setCookieJar ($ cookie_file );
1044
+ $ test ->curl ->setCookieJar ($ cookie_jar );
1047
1045
$ test ->server ('cookiejar ' , 'GET ' );
1048
1046
$ test ->curl ->close ();
1049
1047
1050
- $ this ->assertTrue (!(strpos (file_get_contents ($ cookie_file ), "\t" . 'mycookie ' . "\t" . 'yum ' ) === false ));
1051
- unlink ($ cookie_file );
1052
- $ this ->assertFalse (file_exists ($ cookie_file ));
1048
+ $ this ->assertTrue (!(strpos (file_get_contents ($ cookie_jar ), "\t" . 'mycookie ' . "\t" . 'yum ' ) === false ));
1049
+ unlink ($ cookie_jar );
1050
+ $ this ->assertFalse (file_exists ($ cookie_jar ));
1053
1051
}
1054
1052
1055
1053
public function testMultipleCookieResponse ()
0 commit comments