@@ -14,12 +14,13 @@ public function set_up()
14
14
{
15
15
parent ::set_up ();
16
16
17
- $ this ->client = new xmlrpc_client ('/NOTEXIST.php ' , $ this ->args ['HTTPSERVER ' ], 80 );
18
- $ this ->client ->setDebug ($ this ->args ['DEBUG ' ]);
17
+ $ this ->client = $ this ->getClient ();
19
18
}
20
19
21
20
public function test404 ()
22
21
{
22
+ $ this ->client ->path = '/NOTEXIST.php ' ;
23
+
23
24
$ m = new xmlrpcmsg ('examples.echo ' , array (
24
25
new xmlrpcval ('hello ' , 'string ' ),
25
26
));
@@ -29,6 +30,8 @@ public function test404()
29
30
30
31
public function test404Interop ()
31
32
{
33
+ $ this ->client ->path = '/NOTEXIST.php ' ;
34
+
32
35
$ m = new xmlrpcmsg ('examples.echo ' , array (
33
36
new xmlrpcval ('hello ' , 'string ' ),
34
37
));
@@ -53,14 +56,14 @@ public function testUnsupportedAuth()
53
56
54
57
public function testSrvNotFound ()
55
58
{
56
- $ m = new xmlrpcmsg ('examples.echo ' , array (
57
- new xmlrpcval ('hello ' , 'string ' ),
58
- ));
59
59
$ this ->client ->server .= 'XXX ' ;
60
60
$ dnsinfo = @dns_get_record ($ this ->client ->server );
61
61
if ($ dnsinfo ) {
62
62
$ this ->markTestSkipped ('Seems like there is a catchall DNS in effect: host ' . $ this ->client ->server . ' found ' );
63
63
} else {
64
+ $ m = new xmlrpcmsg ('examples.echo ' , array (
65
+ new xmlrpcval ('hello ' , 'string ' ),
66
+ ));
64
67
$ r = $ this ->client ->send ($ m , 5 );
65
68
// make sure there's no freaking catchall DNS in effect
66
69
$ this ->assertEquals (5 , $ r ->faultCode ());
@@ -90,32 +93,37 @@ public function testCurlKAErr()
90
93
$ this ->client ->port = $ server [1 ];
91
94
}
92
95
$ this ->client ->server = $ server [0 ];
93
- $ this ->client ->path = $ this ->args ['HTTPURI ' ];
94
- $ this ->client ->setCookie ('PHPUNIT_RANDOM_TEST_ID ' , static ::$ randId );
96
+ // $this->client->path = $this->args['HTTPURI'];
97
+ // $this->client->setCookie('PHPUNIT_RANDOM_TEST_ID', static::$randId);
95
98
$ r = $ this ->client ->send ($ m , 5 , 'http11 ' );
96
99
$ this ->assertEquals (0 , $ r ->faultCode ());
97
100
$ ro = $ r ->value ();
98
101
is_object ($ ro ) && $ this ->assertEquals ('hello ' , $ ro ->scalarVal ());
99
102
}
100
103
101
- public function testCustomHeaders ()
104
+ /**
105
+ * @dataProvider getAvailableUseCurlOptions
106
+ */
107
+ public function testCustomHeaders ($ curlOpt )
108
+ {
109
+ $ this ->client ->setOption (\PhpXmlRpc \Client::OPT_USE_CURL , $ curlOpt );
110
+ $ this ->client ->setOption (\PhpXmlRpc \Client::OPT_EXTRA_HEADERS , array ('X-PXR-Test: yes ' ));
111
+ $ r = new \PhpXmlRpc \Request ('tests.getallheaders ' );
112
+ $ r = $ this ->client ->send ($ r );
113
+ $ this ->assertEquals (0 , $ r ->faultCode ());
114
+ $ ro = $ r ->value ();
115
+ $ this ->assertArrayHasKey ('X-Pxr-Test ' , $ ro ->scalarVal (), "Testing with curl mode: $ curlOpt " );
116
+ }
117
+
118
+ public function getAvailableUseCurlOptions ()
102
119
{
103
120
$ opts = array (\PhpXmlRpc \Client::USE_CURL_NEVER );
104
121
if (function_exists ('curl_init ' ))
105
122
{
106
123
$ opts [] = \PhpXmlRpc \Client::USE_CURL_ALWAYS ;
107
124
}
108
125
109
- $ this ->client ->setOption (\PhpXmlRpc \Client::OPT_EXTRA_HEADERS , array ('X-PXR-Test: yes ' ));
110
- $ r = new \PhpXmlRpc \Request ('tests.getallheaders ' );
111
-
112
- foreach ($ opts as $ opt ) {
113
- $ this ->client ->setOption (\PhpXmlRpc \Client::OPT_USE_CURL , $ opt );
114
- $ r = $ this ->client ->send ($ r );
115
- $ this ->assertEquals (0 , $ r ->faultCode ());
116
- $ ro = $ r ->value ();
117
- $ this ->assertArrayHasKey ('X-Pxr-Test ' , $ ro ->scalarVal (), "Testing with curl mode: $ opt " );
118
- }
126
+ return array ($ opts );
119
127
}
120
128
121
129
public function testgetUrl ()
0 commit comments