Passed
Push — master ( 573db6...fc8ac8 )
by Gaetano
10:15
created
tests/08ServerTest.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -1,8 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once __DIR__ . '/../lib/xmlrpc_wrappers.inc';
3
+include_once __DIR__.'/../lib/xmlrpc_wrappers.inc';
4 4
 
5
-include_once __DIR__ . '/ServerAwareTestCase.php';
5
+include_once __DIR__.'/ServerAwareTestCase.php';
6 6
 
7 7
 /**
8 8
  * Tests which involve interaction with the server - carried out via the client.
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
         // (but only if not called from subclass objects / multitests)
30 30
         if (function_exists('debug_backtrace') && strtolower(get_called_class()) == 'localhosttests') {
31 31
             $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
32
-            for ($i = 0; $i < count($trace); $i++) {
32
+            for ($i = 0; $i<count($trace); $i++) {
33 33
                 if (strpos($trace[$i]['function'], 'test') === 0) {
34 34
                     self::$failed_tests[$trace[$i]['function']] = true;
35 35
                     break;
@@ -65,9 +65,9 @@  discard block
 block discarded – undo
65 65
         }
66 66
         $this->validateResponse($r);
67 67
         if (is_array($errorCode)) {
68
-            $this->assertContains($r->faultCode(), $errorCode, 'Error ' . $r->faultCode() . ' connecting to server: ' . $r->faultString());
68
+            $this->assertContains($r->faultCode(), $errorCode, 'Error '.$r->faultCode().' connecting to server: '.$r->faultString());
69 69
         } else {
70
-            $this->assertEquals($errorCode, $r->faultCode(), 'Error ' . $r->faultCode() . ' connecting to server: ' . $r->faultString());
70
+            $this->assertEquals($errorCode, $r->faultCode(), 'Error '.$r->faultCode().' connecting to server: '.$r->faultString());
71 71
         }
72 72
         if (!$r->faultCode()) {
73 73
             if ($returnResponse) {
@@ -94,20 +94,20 @@  discard block
 block discarded – undo
94 94
         $query = parse_url($this->client->path, PHP_URL_QUERY);
95 95
         parse_str($query, $vars);
96 96
         $query = http_build_query(array_merge($vars, $data));
97
-        $this->client->path = parse_url($this->client->path, PHP_URL_PATH) . '?' . $query;
97
+        $this->client->path = parse_url($this->client->path, PHP_URL_PATH).'?'.$query;
98 98
     }
99 99
 
100 100
     public function testString()
101 101
     {
102
-        $sendString = "here are 3 \"entities\": < > & " .
103
-            "and here's a dollar sign: \$pretendvarname and a backslash too: " . chr(92) .
104
-            " - isn't that great? \\\"hackery\\\" at it's best " .
105
-            " also don't want to miss out on \$item[0]. " .
106
-            "The real weird stuff follows: CRLF here" . chr(13) . chr(10) .
107
-            "a simple CR here" . chr(13) .
108
-            "a simple LF here" . chr(10) .
109
-            "and then LFCR" . chr(10) . chr(13) .
110
-            "last but not least weird names: G" . chr(252) . "nter, El" . chr(232) . "ne, and an xml comment closing tag: -->";
102
+        $sendString = "here are 3 \"entities\": < > & ".
103
+            "and here's a dollar sign: \$pretendvarname and a backslash too: ".chr(92).
104
+            " - isn't that great? \\\"hackery\\\" at it's best ".
105
+            " also don't want to miss out on \$item[0]. ".
106
+            "The real weird stuff follows: CRLF here".chr(13).chr(10).
107
+            "a simple CR here".chr(13).
108
+            "a simple LF here".chr(10).
109
+            "and then LFCR".chr(10).chr(13).
110
+            "last but not least weird names: G".chr(252)."nter, El".chr(232)."ne, and an xml comment closing tag: -->";
111 111
         $m = new xmlrpcmsg('examples.stringecho', array(
112 112
             new xmlrpcval($sendString, 'string'),
113 113
         ));
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
     public function testLatin1String()
129 129
     {
130 130
         $sendString =
131
-            "last but not least weird names: G" . chr(252) . "nter, El" . chr(232) . "ne";
131
+            "last but not least weird names: G".chr(252)."nter, El".chr(232)."ne";
132 132
         $x = '<?xml version="1.0" encoding="ISO-8859-1"?><methodCall><methodName>examples.stringecho</methodName><params><param><value>'.
133 133
             $sendString.
134 134
             '</value></param></params></methodCall>';
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
     public function testUtf8Method()
238 238
     {
239 239
         PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding = 'UTF-8';
240
-        $m = new xmlrpcmsg("tests.utf8methodname." . 'κόσμε', array(
240
+        $m = new xmlrpcmsg("tests.utf8methodname.".'κόσμε', array(
241 241
             new xmlrpcval('hello')
242 242
         ));
243 243
         $v = $this->send($m);
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
         ));
259 259
         $v = $this->send($m);
260 260
         if ($v) {
261
-            $this->assertEquals($a + $b, $v->scalarval());
261
+            $this->assertEquals($a+$b, $v->scalarval());
262 262
         }
263 263
     }
264 264
 
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
         ));
271 271
         $v = $this->send($m);
272 272
         if ($v) {
273
-            $this->assertEquals(12 - 23, $v->scalarval());
273
+            $this->assertEquals(12-23, $v->scalarval());
274 274
         }
275 275
     }
276 276
 
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
         if ($v) {
310 310
             $sz = $v->arraysize();
311 311
             $got = '';
312
-            for ($i = 0; $i < $sz; $i++) {
312
+            for ($i = 0; $i<$sz; $i++) {
313 313
                 $b = $v->arraymem($i);
314 314
                 if ($b->scalarval()) {
315 315
                     $got .= '1';
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
             $got = '';
357 357
             $expected = '37210';
358 358
             $expect_array = array('ctLeftAngleBrackets', 'ctRightAngleBrackets', 'ctAmpersands', 'ctApostrophes', 'ctQuotes');
359
-            foreach($expect_array as $val) {
359
+            foreach ($expect_array as $val) {
360 360
                 $b = $v->structmem($val);
361 361
                 $got .= $b->scalarVal();
362 362
             }
@@ -859,7 +859,7 @@  discard block
 block discarded – undo
859 859
     {
860 860
         // make a 'deep client copy' as the original one might have many properties set
861 861
         // also for speed only wrap one method of the whole server
862
-        $class = wrap_xmlrpc_server($this->client, array('simple_client_copy' => 0, 'method_filter' => '/examples\.getStateName/' ));
862
+        $class = wrap_xmlrpc_server($this->client, array('simple_client_copy' => 0, 'method_filter' => '/examples\.getStateName/'));
863 863
         if ($class == '') {
864 864
             $this->fail('Registration of remote server failed');
865 865
         } else {
@@ -898,9 +898,9 @@  discard block
 block discarded – undo
898 898
         $cookies = array(
899 899
             //'c1' => array(),
900 900
             'c2' => array('value' => 'c2'),
901
-            'c3' => array('value' => 'c3', 'expires' => time() + 60 * 60 * 24 * 30),
902
-            'c4' => array('value' => 'c4', 'expires' => time() + 60 * 60 * 24 * 30, 'path' => '/'),
903
-            'c5' => array('value' => 'c5', 'expires' => time() + 60 * 60 * 24 * 30, 'path' => '/', 'domain' => 'localhost'),
901
+            'c3' => array('value' => 'c3', 'expires' => time()+60 * 60 * 24 * 30),
902
+            'c4' => array('value' => 'c4', 'expires' => time()+60 * 60 * 24 * 30, 'path' => '/'),
903
+            'c5' => array('value' => 'c5', 'expires' => time()+60 * 60 * 24 * 30, 'path' => '/', 'domain' => 'localhost'),
904 904
         );
905 905
         $cookiesval = php_xmlrpc_encode($cookies);
906 906
         $m = new xmlrpcmsg('tests.setcookies', array($cookiesval));
@@ -948,10 +948,10 @@  discard block
 block discarded – undo
948 948
         $m = new xmlrpcmsg('tests.getcookies', array());
949 949
         foreach ($cookies as $cookie => $val) {
950 950
             $this->client->setCookie($cookie, $val);
951
-            $cookies[$cookie] = (string)$cookies[$cookie];
951
+            $cookies[$cookie] = (string) $cookies[$cookie];
952 952
         }
953 953
         $r = $this->client->send($m, $this->timeout, $this->method);
954
-        $this->assertEquals(0, $r->faultCode(), 'Error ' . $r->faultCode() . ' connecting to server: ' . $r->faultString());
954
+        $this->assertEquals(0, $r->faultCode(), 'Error '.$r->faultCode().' connecting to server: '.$r->faultString());
955 955
         if (!$r->faultCode()) {
956 956
             $v = $r->value();
957 957
             $v = php_xmlrpc_decode($v);
Please login to merge, or discard this patch.
tests/07ClientTest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once __DIR__ . '/ServerAwareTestCase.php';
3
+include_once __DIR__.'/ServerAwareTestCase.php';
4 4
 
5 5
 /**
6 6
  * Tests involving the Client class (and mostly no server).
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
         $this->client->server .= 'XXX';
60 60
         $dnsinfo = @dns_get_record($this->client->server);
61 61
         if ($dnsinfo) {
62
-            $this->markTestSkipped('Seems like there is a catchall DNS in effect: host ' . $this->client->server . ' found');
62
+            $this->markTestSkipped('Seems like there is a catchall DNS in effect: host '.$this->client->server.' found');
63 63
         } else {
64 64
             $m = new xmlrpcmsg('examples.echo', array(
65 65
                 new xmlrpcval('hello', 'string'),
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 
90 90
         // now test a successful connection
91 91
         $server = explode(':', $this->args['HTTPSERVER']);
92
-        if (count($server) > 1) {
92
+        if (count($server)>1) {
93 93
             $this->client->port = $server[1];
94 94
         }
95 95
         $this->client->server = $server[0];
Please login to merge, or discard this patch.
tests/ServerAwareTestCase.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-include_once __DIR__ . '/LoggerAwareTestCase.php';
3
+include_once __DIR__.'/LoggerAwareTestCase.php';
4 4
 
5 5
 use PHPUnit\Extensions\SeleniumCommon\RemoteCoverage;
6 6
 use PHPUnit\Framework\TestResult;
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
      */
31 31
     public function _run($result = NULL)
32 32
     {
33
-        $this->testId = get_class($this) . '__' . $this->getName();
33
+        $this->testId = get_class($this).'__'.$this->getName();
34 34
 
35 35
         if ($result === NULL) {
36 36
             $result = $this->createResult();
@@ -62,13 +62,13 @@  discard block
 block discarded – undo
62 62
 
63 63
         // Set up a database connection or other fixture which needs to be available.
64 64
         self::$randId = uniqid();
65
-        file_put_contents(sys_get_temp_dir() . '/phpunit_rand_id.txt', self::$randId);
65
+        file_put_contents(sys_get_temp_dir().'/phpunit_rand_id.txt', self::$randId);
66 66
     }
67 67
 
68 68
     public static function tear_down_after_class()
69 69
     {
70
-        if (is_file(sys_get_temp_dir() . '/phpunit_rand_id.txt')) {
71
-            unlink(sys_get_temp_dir() . '/phpunit_rand_id.txt');
70
+        if (is_file(sys_get_temp_dir().'/phpunit_rand_id.txt')) {
71
+            unlink(sys_get_temp_dir().'/phpunit_rand_id.txt');
72 72
         }
73 73
 
74 74
         parent::tear_down_after_class();
@@ -79,14 +79,14 @@  discard block
 block discarded – undo
79 79
         parent::set_up();
80 80
 
81 81
         // assumes HTTPURI to be in the form /tests/index.php?etc...
82
-        $this->baseUrl = 'http://' . $this->args['HTTPSERVER'] . preg_replace('|\?.+|', '', $this->args['HTTPURI']);
83
-        $this->coverageScriptUrl = 'http://' . $this->args['HTTPSERVER'] . preg_replace('|/tests/index\.php(\?.*)?|', '/tests/phpunit_coverage.php', $this->args['HTTPURI']);
82
+        $this->baseUrl = 'http://'.$this->args['HTTPSERVER'].preg_replace('|\?.+|', '', $this->args['HTTPURI']);
83
+        $this->coverageScriptUrl = 'http://'.$this->args['HTTPSERVER'].preg_replace('|/tests/index\.php(\?.*)?|', '/tests/phpunit_coverage.php', $this->args['HTTPURI']);
84 84
     }
85 85
 
86 86
     protected function getClient($customPath)
87 87
     {
88 88
         $server = explode(':', $this->args['HTTPSERVER']);
89
-        if (count($server) > 1) {
89
+        if (count($server)>1) {
90 90
             $client = new xmlrpc_client($this->args['HTTPURI'], $server[0], $server[1]);
91 91
         } else {
92 92
             $client = new xmlrpc_client($this->args['HTTPURI'], $this->args['HTTPSERVER']);
Please login to merge, or discard this patch.