Completed
Push — master ( c4596e...19d9e6 )
by Gaetano
03:28
created
tests/3LocalhostTest.php 2 patches
Doc Comments   +5 added lines, -1 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 
115 115
     /**
116 116
      * @param PhpXmlRpc\Request|array $msg
117
-     * @param int|array $errorCode
117
+     * @param integer $errorCode
118 118
      * @param bool $returnResponse
119 119
      * @return mixed|\PhpXmlRpc\Response|\PhpXmlRpc\Response[]|\PhpXmlRpc\Value|string|null
120 120
      */
@@ -431,6 +431,10 @@  discard block
 block discarded – undo
431 431
         }
432 432
     }
433 433
 
434
+    /**
435
+     * @param string $method
436
+     * @param PhpXmlRpc\Value[] $params
437
+     */
434 438
     public function _multicall_msg($method, $params)
435 439
     {
436 440
         $struct['methodName'] = new xmlrpcval($method, 'string');
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once __DIR__ . '/../lib/xmlrpc.inc';
4
-include_once __DIR__ . '/../lib/xmlrpc_wrappers.inc';
3
+include_once __DIR__.'/../lib/xmlrpc.inc';
4
+include_once __DIR__.'/../lib/xmlrpc_wrappers.inc';
5 5
 
6
-include_once __DIR__ . '/parse_args.php';
6
+include_once __DIR__.'/parse_args.php';
7 7
 
8 8
 /**
9 9
  * Tests which involve interaction between the client and the server.
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
         // (but only if not called from subclass objects / multitests)
33 33
         if (function_exists('debug_backtrace') && strtolower(get_called_class()) == 'localhosttests') {
34 34
             $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
35
-            for ($i = 0; $i < count($trace); $i++) {
35
+            for ($i = 0; $i<count($trace); $i++) {
36 36
                 if (strpos($trace[$i]['function'], 'test') === 0) {
37 37
                     self::$failed_tests[$trace[$i]['function']] = true;
38 38
                     break;
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
      */
54 54
     public function run(PHPUnit_Framework_TestResult $result = NULL)
55 55
     {
56
-        $this->testId = get_class($this) . '__' . $this->getName();
56
+        $this->testId = get_class($this).'__'.$this->getName();
57 57
 
58 58
         if ($result === NULL) {
59 59
             $result = $this->createResult();
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
         $this->args = argParser::getArgs();
85 85
 
86 86
         $server = explode(':', $this->args['LOCALSERVER']);
87
-        if (count($server) > 1) {
87
+        if (count($server)>1) {
88 88
             $this->client = new xmlrpc_client($this->args['URI'], $server[0], $server[1]);
89 89
         } else {
90 90
             $this->client = new xmlrpc_client($this->args['URI'], $this->args['LOCALSERVER']);
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
         $this->client->request_compression = $this->request_compression;
95 95
         $this->client->accepted_compression = $this->accepted_compression;
96 96
 
97
-        $this->coverageScriptUrl = 'http://' . $this->args['LOCALSERVER'] . '/' . str_replace( '/demo/server/server.php', 'tests/phpunit_coverage.php', $this->args['URI'] );
97
+        $this->coverageScriptUrl = 'http://'.$this->args['LOCALSERVER'].'/'.str_replace('/demo/server/server.php', 'tests/phpunit_coverage.php', $this->args['URI']);
98 98
 
99 99
         if ($this->args['DEBUG'] == 1)
100 100
             ob_start();
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
             return $r;
131 131
         }
132 132
         if (is_array($errorCode)) {
133
-            $this->assertContains($r->faultCode(), $errorCode, 'Error ' . $r->faultCode() . ' connecting to server: ' . $r->faultString());
133
+            $this->assertContains($r->faultCode(), $errorCode, 'Error '.$r->faultCode().' connecting to server: '.$r->faultString());
134 134
         } else {
135
-            $this->assertEquals($errorCode, $r->faultCode(), 'Error ' . $r->faultCode() . ' connecting to server: ' . $r->faultString());
135
+            $this->assertEquals($errorCode, $r->faultCode(), 'Error '.$r->faultCode().' connecting to server: '.$r->faultString());
136 136
         }
137 137
         if (!$r->faultCode()) {
138 138
             if ($returnResponse) {
@@ -154,20 +154,20 @@  discard block
 block discarded – undo
154 154
         $query = parse_url($this->client->path, PHP_URL_QUERY);
155 155
         parse_str($query, $vars);
156 156
         $query = http_build_query(array_merge($vars, $data));
157
-        $this->client->path = parse_url($this->client->path, PHP_URL_PATH) . '?' . $query;
157
+        $this->client->path = parse_url($this->client->path, PHP_URL_PATH).'?'.$query;
158 158
     }
159 159
 
160 160
     public function testString()
161 161
     {
162
-        $sendString = "here are 3 \"entities\": < > & " .
163
-            "and here's a dollar sign: \$pretendvarname and a backslash too: " . chr(92) .
164
-            " - isn't that great? \\\"hackery\\\" at it's best " .
165
-            " also don't want to miss out on \$item[0]. " .
166
-            "The real weird stuff follows: CRLF here" . chr(13) . chr(10) .
167
-            "a simple CR here" . chr(13) .
168
-            "a simple LF here" . chr(10) .
169
-            "and then LFCR" . chr(10) . chr(13) .
170
-            "last but not least weird names: G" . chr(252) . "nter, El" . chr(232) . "ne, and an xml comment closing tag: -->";
162
+        $sendString = "here are 3 \"entities\": < > & ".
163
+            "and here's a dollar sign: \$pretendvarname and a backslash too: ".chr(92).
164
+            " - isn't that great? \\\"hackery\\\" at it's best ".
165
+            " also don't want to miss out on \$item[0]. ".
166
+            "The real weird stuff follows: CRLF here".chr(13).chr(10).
167
+            "a simple CR here".chr(13).
168
+            "a simple LF here".chr(10).
169
+            "and then LFCR".chr(10).chr(13).
170
+            "last but not least weird names: G".chr(252)."nter, El".chr(232)."ne, and an xml comment closing tag: -->";
171 171
         $m = new xmlrpcmsg('examples.stringecho', array(
172 172
             new xmlrpcval($sendString, 'string'),
173 173
         ));
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
     public function testLatin1String()
189 189
     {
190 190
         $sendString =
191
-            "last but not least weird names: G" . chr(252) . "nter, El" . chr(232) . "ne";
191
+            "last but not least weird names: G".chr(252)."nter, El".chr(232)."ne";
192 192
         $x = '<?xml version="1.0" encoding="ISO-8859-1"?><methodCall><methodName>examples.stringecho</methodName><params><param><value>'.
193 193
             $sendString.
194 194
             '</value></param></params></methodCall>';
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
     public function testUtf8Method()
293 293
     {
294 294
         PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding = 'UTF-8';
295
-        $m = new xmlrpcmsg("tests.utf8methodname." . 'κόσμε', array(
295
+        $m = new xmlrpcmsg("tests.utf8methodname.".'κόσμε', array(
296 296
             new xmlrpcval('hello')
297 297
         ));
298 298
         $v = $this->send($m);
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
         ));
315 315
         $v = $this->send($m);
316 316
         if ($v) {
317
-            $this->assertEquals($a + $b, $v->scalarval());
317
+            $this->assertEquals($a+$b, $v->scalarval());
318 318
         }
319 319
     }
320 320
 
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
         ));
327 327
         $v = $this->send($m);
328 328
         if ($v) {
329
-            $this->assertEquals(12 - 23, $v->scalarval());
329
+            $this->assertEquals(12-23, $v->scalarval());
330 330
         }
331 331
     }
332 332
 
@@ -360,7 +360,7 @@  discard block
 block discarded – undo
360 360
         if ($v) {
361 361
             $sz = $v->arraysize();
362 362
             $got = '';
363
-            for ($i = 0; $i < $sz; $i++) {
363
+            for ($i = 0; $i<$sz; $i++) {
364 364
                 $b = $v->arraymem($i);
365 365
                 if ($b->scalarval()) {
366 366
                     $got .= '1';
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
             $got = '';
424 424
             $expected = '37210';
425 425
             $expect_array = array('ctLeftAngleBrackets', 'ctRightAngleBrackets', 'ctAmpersands', 'ctApostrophes', 'ctQuotes');
426
-            foreach($expect_array as $val) {
426
+            foreach ($expect_array as $val) {
427 427
                 $b = $v->structmem($val);
428 428
                 $got .= $b->me['int'];
429 429
             }
@@ -841,7 +841,7 @@  discard block
 block discarded – undo
841 841
     {
842 842
         // make a 'deep client copy' as the original one might have many properties set
843 843
         // also for speed only wrap one method of the whole server
844
-        $class = wrap_xmlrpc_server($this->client, array('simple_client_copy' => 0, 'method_filter' => '/examples\.getStateName/' ));
844
+        $class = wrap_xmlrpc_server($this->client, array('simple_client_copy' => 0, 'method_filter' => '/examples\.getStateName/'));
845 845
         if ($class == '') {
846 846
             $this->fail('Registration of remote server failed');
847 847
         } else {
@@ -876,9 +876,9 @@  discard block
 block discarded – undo
876 876
         $cookies = array(
877 877
             //'c1' => array(),
878 878
             'c2' => array('value' => 'c2'),
879
-            'c3' => array('value' => 'c3', 'expires' => time() + 60 * 60 * 24 * 30),
880
-            'c4' => array('value' => 'c4', 'expires' => time() + 60 * 60 * 24 * 30, 'path' => '/'),
881
-            'c5' => array('value' => 'c5', 'expires' => time() + 60 * 60 * 24 * 30, 'path' => '/', 'domain' => 'localhost'),
879
+            'c3' => array('value' => 'c3', 'expires' => time()+60 * 60 * 24 * 30),
880
+            'c4' => array('value' => 'c4', 'expires' => time()+60 * 60 * 24 * 30, 'path' => '/'),
881
+            'c5' => array('value' => 'c5', 'expires' => time()+60 * 60 * 24 * 30, 'path' => '/', 'domain' => 'localhost'),
882 882
         );
883 883
         $cookiesval = php_xmlrpc_encode($cookies);
884 884
         $m = new xmlrpcmsg('examples.setcookies', array($cookiesval));
@@ -926,10 +926,10 @@  discard block
 block discarded – undo
926 926
         $m = new xmlrpcmsg('examples.getcookies', array());
927 927
         foreach ($cookies as $cookie => $val) {
928 928
             $this->client->setCookie($cookie, $val);
929
-            $cookies[$cookie] = (string)$cookies[$cookie];
929
+            $cookies[$cookie] = (string) $cookies[$cookie];
930 930
         }
931 931
         $r = $this->client->send($m, $this->timeout, $this->method);
932
-        $this->assertEquals(0, $r->faultCode(), 'Error ' . $r->faultCode() . ' connecting to server: ' . $r->faultString());
932
+        $this->assertEquals(0, $r->faultCode(), 'Error '.$r->faultCode().' connecting to server: '.$r->faultString());
933 933
         if (!$r->faultCode()) {
934 934
             $v = $r->value();
935 935
             $v = php_xmlrpc_decode($v);
Please login to merge, or discard this patch.
tests/4LocalhostMultiTest.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once __DIR__ . '/../lib/xmlrpc.inc';
4
-include_once __DIR__ . '/../lib/xmlrpc_wrappers.inc';
3
+include_once __DIR__.'/../lib/xmlrpc.inc';
4
+include_once __DIR__.'/../lib/xmlrpc_wrappers.inc';
5 5
 
6
-include_once __DIR__ . '/parse_args.php';
6
+include_once __DIR__.'/parse_args.php';
7 7
 
8
-include_once __DIR__ . '/3LocalhostTest.php';
8
+include_once __DIR__.'/3LocalhostTest.php';
9 9
 
10 10
 /**
11 11
  * Tests which stress http features of the library.
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
             'testcatchWarnings', 'testWrappedMethodAsSource', 'testTransferOfObjectViaWrapping');
28 28
 
29 29
         $methods = array();
30
-        foreach(get_class_methods('LocalhostTest') as $method)
30
+        foreach (get_class_methods('LocalhostTest') as $method)
31 31
         {
32
-            if(strpos($method, 'test') === 0 && !in_array($method, $unsafeMethods))
32
+            if (strpos($method, 'test') === 0 && !in_array($method, $unsafeMethods))
33 33
             {
34 34
                 if (!isset(self::$failed_tests[$method])) {
35 35
                     $methods[$method] = array($method);
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
      */
47 47
     public function testDeflate($method)
48 48
     {
49
-        if(!function_exists('gzdeflate'))
49
+        if (!function_exists('gzdeflate'))
50 50
         {
51 51
             $this->markTestSkipped('Zlib missing: cannot test deflate functionality');
52 52
             return;
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
      */
65 65
     public function testGzip($method)
66 66
     {
67
-        if(!function_exists('gzdeflate'))
67
+        if (!function_exists('gzdeflate'))
68 68
         {
69 69
             $this->markTestSkipped('Zlib missing: cannot test gzip functionality');
70 70
             return;
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 
79 79
     public function testKeepAlives()
80 80
     {
81
-        if(!function_exists('curl_init'))
81
+        if (!function_exists('curl_init'))
82 82
         {
83 83
             $this->markTestSkipped('CURL missing: cannot test http 1.1');
84 84
             return;
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
      */
118 118
     public function testHttp11($method)
119 119
     {
120
-        if(!function_exists('curl_init'))
120
+        if (!function_exists('curl_init'))
121 121
         {
122 122
             $this->markTestSkipped('CURL missing: cannot test http 1.1');
123 123
             return;
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
      */
137 137
     public function testHttp11Gzip($method)
138 138
     {
139
-        if(!function_exists('curl_init'))
139
+        if (!function_exists('curl_init'))
140 140
         {
141 141
             $this->markTestSkipped('CURL missing: cannot test http 1.1');
142 142
             return;
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
      */
157 157
     public function testHttp11Deflate($method)
158 158
     {
159
-        if(!function_exists('curl_init'))
159
+        if (!function_exists('curl_init'))
160 160
         {
161 161
             $this->markTestSkipped('CURL missing: cannot test http 1.1');
162 162
             return;
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
      */
177 177
     public function testHttp11Proxy($method)
178 178
     {
179
-        if(!function_exists('curl_init'))
179
+        if (!function_exists('curl_init'))
180 180
         {
181 181
             $this->markTestSkipped('CURL missing: cannot test http 1.1 w. proxy');
182 182
             return;
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
      */
202 202
     public function testHttps($method)
203 203
     {
204
-        if(!function_exists('curl_init'))
204
+        if (!function_exists('curl_init'))
205 205
         {
206 206
             $this->markTestSkipped('CURL missing: cannot test https functionality');
207 207
             return;
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
      */
225 225
     public function testHttpsProxy($method)
226 226
     {
227
-        if(!function_exists('curl_init'))
227
+        if (!function_exists('curl_init'))
228 228
         {
229 229
             $this->markTestSkipped('CURL missing: cannot test https functionality');
230 230
             return;
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -180,8 +180,7 @@  discard block
 block discarded – undo
180 180
         {
181 181
             $this->markTestSkipped('CURL missing: cannot test http 1.1 w. proxy');
182 182
             return;
183
-        }
184
-        else if ($this->args['PROXYSERVER'] == '')
183
+        } else if ($this->args['PROXYSERVER'] == '')
185 184
         {
186 185
             $this->markTestSkipped('PROXY definition missing: cannot test proxy w. http 1.1');
187 186
             return;
@@ -228,8 +227,7 @@  discard block
 block discarded – undo
228 227
         {
229 228
             $this->markTestSkipped('CURL missing: cannot test https functionality');
230 229
             return;
231
-        }
232
-        else if ($this->args['PROXYSERVER'] == '')
230
+        } else if ($this->args['PROXYSERVER'] == '')
233 231
         {
234 232
             $this->markTestSkipped('PROXY definition missing: cannot test proxy w. http 1.1');
235 233
             return;
Please login to merge, or discard this patch.