Passed
Push — master ( 0c0b5a...7953de )
by Gaetano
05:21
created
tests/5ServerTest.php 1 patch
Spacing   +32 added lines, -32 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__ . '/PolyfillTestCase.php';
8
+include_once __DIR__.'/PolyfillTestCase.php';
9 9
 
10 10
 use PHPUnit\Extensions\SeleniumCommon\RemoteCoverage;
11 11
 use PHPUnit\Framework\TestResult;
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
         // (but only if not called from subclass objects / multitests)
43 43
         if (function_exists('debug_backtrace') && strtolower(get_called_class()) == 'localhosttests') {
44 44
             $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
45
-            for ($i = 0; $i < count($trace); $i++) {
45
+            for ($i = 0; $i<count($trace); $i++) {
46 46
                 if (strpos($trace[$i]['function'], 'test') === 0) {
47 47
                     self::$failed_tests[$trace[$i]['function']] = true;
48 48
                     break;
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      */
66 66
     public function _run($result = NULL)
67 67
     {
68
-        $this->testId = get_class($this) . '__' . $this->getName();
68
+        $this->testId = get_class($this).'__'.$this->getName();
69 69
 
70 70
         if ($result === NULL) {
71 71
             $result = $this->createResult();
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
         $this->args = argParser::getArgs();
97 97
 
98 98
         $server = explode(':', $this->args['HTTPSERVER']);
99
-        if (count($server) > 1) {
99
+        if (count($server)>1) {
100 100
             $this->client = new xmlrpc_client($this->args['HTTPURI'], $server[0], $server[1]);
101 101
         } else {
102 102
             $this->client = new xmlrpc_client($this->args['HTTPURI'], $this->args['HTTPSERVER']);
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
         $this->client->request_compression = $this->request_compression;
107 107
         $this->client->accepted_compression = $this->accepted_compression;
108 108
 
109
-        $this->coverageScriptUrl = 'http://' . $this->args['HTTPSERVER'] . '/' . str_replace( '/demo/server/server.php', 'tests/phpunit_coverage.php', $this->args['HTTPURI'] );
109
+        $this->coverageScriptUrl = 'http://'.$this->args['HTTPSERVER'].'/'.str_replace('/demo/server/server.php', 'tests/phpunit_coverage.php', $this->args['HTTPURI']);
110 110
 
111 111
         if ($this->args['DEBUG'] == 1)
112 112
             ob_start();
@@ -143,9 +143,9 @@  discard block
 block discarded – undo
143 143
         }
144 144
         $this->validateResponse($r);
145 145
         if (is_array($errorCode)) {
146
-            $this->assertContains($r->faultCode(), $errorCode, 'Error ' . $r->faultCode() . ' connecting to server: ' . $r->faultString());
146
+            $this->assertContains($r->faultCode(), $errorCode, 'Error '.$r->faultCode().' connecting to server: '.$r->faultString());
147 147
         } else {
148
-            $this->assertEquals($errorCode, $r->faultCode(), 'Error ' . $r->faultCode() . ' connecting to server: ' . $r->faultString());
148
+            $this->assertEquals($errorCode, $r->faultCode(), 'Error '.$r->faultCode().' connecting to server: '.$r->faultString());
149 149
         }
150 150
         if (!$r->faultCode()) {
151 151
             if ($returnResponse) {
@@ -172,20 +172,20 @@  discard block
 block discarded – undo
172 172
         $query = parse_url($this->client->path, PHP_URL_QUERY);
173 173
         parse_str($query, $vars);
174 174
         $query = http_build_query(array_merge($vars, $data));
175
-        $this->client->path = parse_url($this->client->path, PHP_URL_PATH) . '?' . $query;
175
+        $this->client->path = parse_url($this->client->path, PHP_URL_PATH).'?'.$query;
176 176
     }
177 177
 
178 178
     public function testString()
179 179
     {
180
-        $sendString = "here are 3 \"entities\": < > & " .
181
-            "and here's a dollar sign: \$pretendvarname and a backslash too: " . chr(92) .
182
-            " - isn't that great? \\\"hackery\\\" at it's best " .
183
-            " also don't want to miss out on \$item[0]. " .
184
-            "The real weird stuff follows: CRLF here" . chr(13) . chr(10) .
185
-            "a simple CR here" . chr(13) .
186
-            "a simple LF here" . chr(10) .
187
-            "and then LFCR" . chr(10) . chr(13) .
188
-            "last but not least weird names: G" . chr(252) . "nter, El" . chr(232) . "ne, and an xml comment closing tag: -->";
180
+        $sendString = "here are 3 \"entities\": < > & ".
181
+            "and here's a dollar sign: \$pretendvarname and a backslash too: ".chr(92).
182
+            " - isn't that great? \\\"hackery\\\" at it's best ".
183
+            " also don't want to miss out on \$item[0]. ".
184
+            "The real weird stuff follows: CRLF here".chr(13).chr(10).
185
+            "a simple CR here".chr(13).
186
+            "a simple LF here".chr(10).
187
+            "and then LFCR".chr(10).chr(13).
188
+            "last but not least weird names: G".chr(252)."nter, El".chr(232)."ne, and an xml comment closing tag: -->";
189 189
         $m = new xmlrpcmsg('examples.stringecho', array(
190 190
             new xmlrpcval($sendString, 'string'),
191 191
         ));
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
     public function testLatin1String()
207 207
     {
208 208
         $sendString =
209
-            "last but not least weird names: G" . chr(252) . "nter, El" . chr(232) . "ne";
209
+            "last but not least weird names: G".chr(252)."nter, El".chr(232)."ne";
210 210
         $x = '<?xml version="1.0" encoding="ISO-8859-1"?><methodCall><methodName>examples.stringecho</methodName><params><param><value>'.
211 211
             $sendString.
212 212
             '</value></param></params></methodCall>';
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
     public function testUtf8Method()
311 311
     {
312 312
         PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding = 'UTF-8';
313
-        $m = new xmlrpcmsg("tests.utf8methodname." . 'κόσμε', array(
313
+        $m = new xmlrpcmsg("tests.utf8methodname.".'κόσμε', array(
314 314
             new xmlrpcval('hello')
315 315
         ));
316 316
         $v = $this->send($m);
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
         ));
333 333
         $v = $this->send($m);
334 334
         if ($v) {
335
-            $this->assertEquals($a + $b, $v->scalarval());
335
+            $this->assertEquals($a+$b, $v->scalarval());
336 336
         }
337 337
     }
338 338
 
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
         ));
345 345
         $v = $this->send($m);
346 346
         if ($v) {
347
-            $this->assertEquals(12 - 23, $v->scalarval());
347
+            $this->assertEquals(12-23, $v->scalarval());
348 348
         }
349 349
     }
350 350
 
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
         if ($v) {
379 379
             $sz = $v->arraysize();
380 380
             $got = '';
381
-            for ($i = 0; $i < $sz; $i++) {
381
+            for ($i = 0; $i<$sz; $i++) {
382 382
                 $b = $v->arraymem($i);
383 383
                 if ($b->scalarval()) {
384 384
                     $got .= '1';
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
             $got = '';
442 442
             $expected = '37210';
443 443
             $expect_array = array('ctLeftAngleBrackets', 'ctRightAngleBrackets', 'ctAmpersands', 'ctApostrophes', 'ctQuotes');
444
-            foreach($expect_array as $val) {
444
+            foreach ($expect_array as $val) {
445 445
                 $b = $v->structmem($val);
446 446
                 $got .= $b->me['int'];
447 447
             }
@@ -894,7 +894,7 @@  discard block
 block discarded – undo
894 894
     {
895 895
         // make a 'deep client copy' as the original one might have many properties set
896 896
         // also for speed only wrap one method of the whole server
897
-        $class = wrap_xmlrpc_server($this->client, array('simple_client_copy' => 0, 'method_filter' => '/examples\.getStateName/' ));
897
+        $class = wrap_xmlrpc_server($this->client, array('simple_client_copy' => 0, 'method_filter' => '/examples\.getStateName/'));
898 898
         if ($class == '') {
899 899
             $this->fail('Registration of remote server failed');
900 900
         } else {
@@ -933,9 +933,9 @@  discard block
 block discarded – undo
933 933
         $cookies = array(
934 934
             //'c1' => array(),
935 935
             'c2' => array('value' => 'c2'),
936
-            'c3' => array('value' => 'c3', 'expires' => time() + 60 * 60 * 24 * 30),
937
-            'c4' => array('value' => 'c4', 'expires' => time() + 60 * 60 * 24 * 30, 'path' => '/'),
938
-            'c5' => array('value' => 'c5', 'expires' => time() + 60 * 60 * 24 * 30, 'path' => '/', 'domain' => 'localhost'),
936
+            'c3' => array('value' => 'c3', 'expires' => time()+60 * 60 * 24 * 30),
937
+            'c4' => array('value' => 'c4', 'expires' => time()+60 * 60 * 24 * 30, 'path' => '/'),
938
+            'c5' => array('value' => 'c5', 'expires' => time()+60 * 60 * 24 * 30, 'path' => '/', 'domain' => 'localhost'),
939 939
         );
940 940
         $cookiesval = php_xmlrpc_encode($cookies);
941 941
         $m = new xmlrpcmsg('examples.setcookies', array($cookiesval));
@@ -983,10 +983,10 @@  discard block
 block discarded – undo
983 983
         $m = new xmlrpcmsg('examples.getcookies', array());
984 984
         foreach ($cookies as $cookie => $val) {
985 985
             $this->client->setCookie($cookie, $val);
986
-            $cookies[$cookie] = (string)$cookies[$cookie];
986
+            $cookies[$cookie] = (string) $cookies[$cookie];
987 987
         }
988 988
         $r = $this->client->send($m, $this->timeout, $this->method);
989
-        $this->assertEquals(0, $r->faultCode(), 'Error ' . $r->faultCode() . ' connecting to server: ' . $r->faultString());
989
+        $this->assertEquals(0, $r->faultCode(), 'Error '.$r->faultCode().' connecting to server: '.$r->faultString());
990 990
         if (!$r->faultCode()) {
991 991
             $v = $r->value();
992 992
             $v = php_xmlrpc_decode($v);
Please login to merge, or discard this patch.