@@ -96,14 +96,16 @@ |
||
96 | 96 | |
97 | 97 | $this->coverageScriptUrl = 'http://' . $this->args['LOCALSERVER'] . '/' . str_replace( '/demo/server/server.php', 'tests/phpunit_coverage.php', $this->args['URI'] ); |
98 | 98 | |
99 | - if ($this->args['DEBUG'] == 1) |
|
100 | - ob_start(); |
|
99 | + if ($this->args['DEBUG'] == 1) { |
|
100 | + ob_start(); |
|
101 | + } |
|
101 | 102 | } |
102 | 103 | |
103 | 104 | protected function tearDown() |
104 | 105 | { |
105 | - if ($this->args['DEBUG'] != 1) |
|
106 | - return; |
|
106 | + if ($this->args['DEBUG'] != 1) { |
|
107 | + return; |
|
108 | + } |
|
107 | 109 | $out = ob_get_clean(); |
108 | 110 | $status = $this->getStatus(); |
109 | 111 | if ($status == PHPUnit_Runner_BaseTestRunner::STATUS_ERROR |
@@ -1,9 +1,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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); |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once __DIR__ . '/../lib/xmlrpc.inc'; |
|
3 | +include_once __DIR__.'/../lib/xmlrpc.inc'; |
|
4 | 4 | |
5 | -include_once __DIR__ . '/parse_args.php'; |
|
5 | +include_once __DIR__.'/parse_args.php'; |
|
6 | 6 | |
7 | 7 | /** |
8 | 8 | * Tests involving requests sent to non-existing servers |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | // make sure there's no freaking catchall DNS in effect |
56 | 56 | $dnsinfo = dns_get_record($this->client->server); |
57 | 57 | if ($dnsinfo) { |
58 | - $this->markTestSkipped('Seems like there is a catchall DNS in effect: host ' . $this->client->server . ' found'); |
|
58 | + $this->markTestSkipped('Seems like there is a catchall DNS in effect: host '.$this->client->server.' found'); |
|
59 | 59 | } else { |
60 | 60 | $this->assertEquals(5, $r->faultCode()); |
61 | 61 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | |
81 | 81 | // now test a successful connection |
82 | 82 | $server = explode(':', $this->args['LOCALSERVER']); |
83 | - if (count($server) > 1) { |
|
83 | + if (count($server)>1) { |
|
84 | 84 | $this->client->port = $server[1]; |
85 | 85 | } |
86 | 86 | $this->client->server = $server[0]; |
@@ -20,14 +20,16 @@ |
||
20 | 20 | $this->client = new xmlrpc_client('/NOTEXIST.php', $this->args['LOCALSERVER'], 80); |
21 | 21 | $this->client->setDebug($this->args['DEBUG']); |
22 | 22 | |
23 | - if ($this->args['DEBUG'] == 1) |
|
24 | - ob_start(); |
|
23 | + if ($this->args['DEBUG'] == 1) { |
|
24 | + ob_start(); |
|
25 | + } |
|
25 | 26 | } |
26 | 27 | |
27 | 28 | protected function tearDown() |
28 | 29 | { |
29 | - if ($this->args['DEBUG'] != 1) |
|
30 | - return; |
|
30 | + if ($this->args['DEBUG'] != 1) { |
|
31 | + return; |
|
32 | + } |
|
31 | 33 | $out = ob_get_clean(); |
32 | 34 | $status = $this->getStatus(); |
33 | 35 | if ($status == PHPUnit_Runner_BaseTestRunner::STATUS_ERROR |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once __DIR__ . '/LocalFileTestCase.php'; |
|
3 | +include_once __DIR__.'/LocalFileTestCase.php'; |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Tests for php files in the 'extras' directory |
@@ -11,9 +11,9 @@ discard block |
||
11 | 11 | { |
12 | 12 | $this->args = argParser::getArgs(); |
13 | 13 | |
14 | - $this->baseUrl = $this->args['LOCALSERVER'] . str_replace( '/demo/server/server.php', '/tests/', $this->args['URI'] ); |
|
14 | + $this->baseUrl = $this->args['LOCALSERVER'].str_replace('/demo/server/server.php', '/tests/', $this->args['URI']); |
|
15 | 15 | |
16 | - $this->coverageScriptUrl = 'http://' . $this->args['LOCALSERVER'] . '/' . str_replace( '/demo/server/server.php', 'tests/phpunit_coverage.php', $this->args['URI'] ); |
|
16 | + $this->coverageScriptUrl = 'http://'.$this->args['LOCALSERVER'].'/'.str_replace('/demo/server/server.php', 'tests/phpunit_coverage.php', $this->args['URI']); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | public function testVerifyCompat() |
@@ -17,14 +17,16 @@ |
||
17 | 17 | protected function setUp() |
18 | 18 | { |
19 | 19 | $this->args = argParser::getArgs(); |
20 | - if ($this->args['DEBUG'] == 1) |
|
21 | - ob_start(); |
|
20 | + if ($this->args['DEBUG'] == 1) { |
|
21 | + ob_start(); |
|
22 | + } |
|
22 | 23 | } |
23 | 24 | |
24 | 25 | protected function tearDown() |
25 | 26 | { |
26 | - if ($this->args['DEBUG'] != 1) |
|
27 | - return; |
|
27 | + if ($this->args['DEBUG'] != 1) { |
|
28 | + return; |
|
29 | + } |
|
28 | 30 | $out = ob_get_clean(); |
29 | 31 | $status = $this->getStatus(); |
30 | 32 | if ($status == PHPUnit_Runner_BaseTestRunner::STATUS_ERROR |
@@ -2,10 +2,10 @@ discard block |
||
2 | 2 | /** |
3 | 3 | * NB: do not let your IDE fool you. The correct encoding for this file is NOT UTF8. |
4 | 4 | */ |
5 | -include_once __DIR__ . '/../lib/xmlrpc.inc'; |
|
6 | -include_once __DIR__ . '/../lib/xmlrpcs.inc'; |
|
5 | +include_once __DIR__.'/../lib/xmlrpc.inc'; |
|
6 | +include_once __DIR__.'/../lib/xmlrpcs.inc'; |
|
7 | 7 | |
8 | -include_once __DIR__ . '/parse_args.php'; |
|
8 | +include_once __DIR__.'/parse_args.php'; |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Tests involving parsing of xml and handling of xmlrpc values |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | |
62 | 62 | public function testUnicodeInMemberName() |
63 | 63 | { |
64 | - $str = "G" . chr(252) . "nter, El" . chr(232) . "ne"; |
|
64 | + $str = "G".chr(252)."nter, El".chr(232)."ne"; |
|
65 | 65 | $v = array($str => new xmlrpcval(1)); |
66 | 66 | $r = new xmlrpcresp(new xmlrpcval($v, 'struct')); |
67 | 67 | $r = $r->serialize(); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | '<?xml version="1.0"?> |
78 | 78 | <!-- $Id --> |
79 | 79 | <!-- found by G. Giunta, covers what happens when lib receives UTF8 chars in response text and comments --> |
80 | -<!-- ' . chr(224) . chr(252) . chr(232) . 'àüè --> |
|
80 | +<!-- ' . chr(224).chr(252).chr(232).'àüè --> |
|
81 | 81 | <methodResponse> |
82 | 82 | <fault> |
83 | 83 | <value> |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | </member> |
89 | 89 | <member> |
90 | 90 | <name>faultString</name> |
91 | -<value><string>' . chr(224) . chr(252) . chr(232) . 'àüè</string></value> |
|
91 | +<value><string>' . chr(224).chr(252).chr(232).'àüè</string></value> |
|
92 | 92 | </member> |
93 | 93 | </struct> |
94 | 94 | </value> |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $m = $this->newMsg('dummy'); |
98 | 98 | $r = $m->parseResponse($response); |
99 | 99 | $v = $r->faultString(); |
100 | - $this->assertEquals(chr(224) . chr(252) . chr(232) . chr(224) . chr(252) . chr(232), $v); |
|
100 | + $this->assertEquals(chr(224).chr(252).chr(232).chr(224).chr(252).chr(232), $v); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | public function testValidNumbers() |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | |
159 | 159 | public function testI8() |
160 | 160 | { |
161 | - if (PHP_INT_SIZE == 4 ) { |
|
161 | + if (PHP_INT_SIZE == 4) { |
|
162 | 162 | $this->markTestSkipped('did not find a locale which sets decimal separator to comma'); |
163 | 163 | return; |
164 | 164 | } |
@@ -481,11 +481,11 @@ discard block |
||
481 | 481 | |
482 | 482 | public function testUTF8Response() |
483 | 483 | { |
484 | - $string = chr(224) . chr(252) . chr(232); |
|
484 | + $string = chr(224).chr(252).chr(232); |
|
485 | 485 | |
486 | 486 | $s = $this->newMsg('dummy'); |
487 | - $f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=UTF-8\r\n\r\n" . '<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
|
488 | -<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . utf8_encode($string) . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
487 | + $f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=UTF-8\r\n\r\n".'<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
|
488 | +<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . utf8_encode($string).'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
489 | 489 | '; |
490 | 490 | $r = $s->parseResponse($f, false, 'phpvals'); |
491 | 491 | $v = $r->value(); |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | $this->assertEquals($string, $v); |
494 | 494 | |
495 | 495 | $f = '<?xml version="1.0" encoding="UTF-8"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
496 | -<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . utf8_encode($string) . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
496 | +<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . utf8_encode($string).'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
497 | 497 | '; |
498 | 498 | $r = $s->parseResponse($f, false, 'phpvals'); |
499 | 499 | $v = $r->value(); |
@@ -508,11 +508,11 @@ discard block |
||
508 | 508 | |
509 | 509 | public function testLatin1Response() |
510 | 510 | { |
511 | - $string = chr(224) . chr(252) . chr(232); |
|
511 | + $string = chr(224).chr(252).chr(232); |
|
512 | 512 | |
513 | 513 | $s = $this->newMsg('dummy'); |
514 | - $f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=ISO-8859-1\r\n\r\n" . '<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
|
515 | -<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . $string . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
514 | + $f = "HTTP/1.1 200 OK\r\nContent-type: text/xml; charset=ISO-8859-1\r\n\r\n".'<?xml version="1.0"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
|
515 | +<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . $string.'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
516 | 516 | '; |
517 | 517 | $r = $s->parseResponse($f, false, 'phpvals'); |
518 | 518 | $v = $r->value(); |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | $this->assertEquals($string, $v); |
521 | 521 | |
522 | 522 | $f = '<?xml version="1.0" encoding="ISO-8859-1"?><methodResponse><params><param><value><struct><member><name>userid</name><value>311127</value></member> |
523 | -<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . $string . '</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
523 | +<member><name>dateCreated</name><value><dateTime.iso8601>20011126T09:17:52</dateTime.iso8601></value></member><member><name>content</name><value>' . $string.'</value></member><member><name>postid</name><value>7414222</value></member></struct></value></param></params></methodResponse> |
|
524 | 524 | '; |
525 | 525 | $r = $s->parseResponse($f, false, 'phpvals'); |
526 | 526 | $v = $r->value(); |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | $this->assertequals(1, count($v1)); |
616 | 616 | $out = array('me' => array(), 'mytype' => 2, '_php_class' => null); |
617 | 617 | |
618 | - foreach($v1 as $key => $val) |
|
618 | + foreach ($v1 as $key => $val) |
|
619 | 619 | { |
620 | 620 | $this->assertArrayHasKey($key, $out); |
621 | 621 | $expected = $out[$key]; |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | $this->assertequals(2, count($v2)); |
631 | 631 | $out = array(array('key' => 0, 'value' => 'object'), array('key' => 1, 'value' => 'object')); |
632 | 632 | $i = 0; |
633 | - foreach($v2 as $key => $val) |
|
633 | + foreach ($v2 as $key => $val) |
|
634 | 634 | { |
635 | 635 | $expected = $out[$i]; |
636 | 636 | $this->assertequals($expected['key'], $key); |
@@ -643,7 +643,7 @@ discard block |
||
643 | 643 | { |
644 | 644 | // nb: make sure that the serialized xml corresponding to this is > 10MB in size |
645 | 645 | $data = array(); |
646 | - for ($i = 0; $i < 500000; $i++ ) { |
|
646 | + for ($i = 0; $i<500000; $i++) { |
|
647 | 647 | $data[] = 'hello world'; |
648 | 648 | } |
649 | 649 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once __DIR__ . '/LocalFileTestCase.php'; |
|
3 | +include_once __DIR__.'/LocalFileTestCase.php'; |
|
4 | 4 | |
5 | 5 | /** |
6 | 6 | * Tests for php files in the 'demo' directory |
@@ -11,9 +11,9 @@ discard block |
||
11 | 11 | { |
12 | 12 | $this->args = argParser::getArgs(); |
13 | 13 | |
14 | - $this->baseUrl = $this->args['LOCALSERVER'] . str_replace( '/demo/server/server.php', '/demo/', $this->args['URI'] ); |
|
14 | + $this->baseUrl = $this->args['LOCALSERVER'].str_replace('/demo/server/server.php', '/demo/', $this->args['URI']); |
|
15 | 15 | |
16 | - $this->coverageScriptUrl = 'http://' . $this->args['LOCALSERVER'] . '/' . str_replace( '/demo/server/server.php', 'tests/phpunit_coverage.php', $this->args['URI'] ); |
|
16 | + $this->coverageScriptUrl = 'http://'.$this->args['LOCALSERVER'].'/'.str_replace('/demo/server/server.php', 'tests/phpunit_coverage.php', $this->args['URI']); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | public function testAgeSort() |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once __DIR__ . "/../../vendor/autoload.php"; |
|
3 | +include_once __DIR__."/../../vendor/autoload.php"; |
|
4 | 4 | |
5 | 5 | use PhpXmlRpc\Value; |
6 | 6 | |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | $count = 0; |
32 | 32 | } |
33 | 33 | // add the new comment in |
34 | - dba_insert($msgID . "_comment_${count}", $comment, $dbh); |
|
35 | - dba_insert($msgID . "_name_${count}", $name, $dbh); |
|
34 | + dba_insert($msgID."_comment_${count}", $comment, $dbh); |
|
35 | + dba_insert($msgID."_name_${count}", $name, $dbh); |
|
36 | 36 | $count++; |
37 | 37 | dba_replace($countID, $count, $dbh); |
38 | 38 | dba_close($dbh); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | $countID = "${msgID}_count"; |
66 | 66 | if (dba_exists($countID, $dbh)) { |
67 | 67 | $count = dba_fetch($countID, $dbh); |
68 | - for ($i = 0; $i < $count; $i++) { |
|
68 | + for ($i = 0; $i<$count; $i++) { |
|
69 | 69 | $name = dba_fetch("${msgID}_name_${i}", $dbh); |
70 | 70 | $comment = dba_fetch("${msgID}_comment_${i}", $dbh); |
71 | 71 | // push a new struct onto the return array |
@@ -209,11 +209,12 @@ |
||
209 | 209 | $a = $req->getParam(0); |
210 | 210 | $b = $req->getParam(1); |
211 | 211 | |
212 | - if ($a->scalartyp() == Value::$xmlrpcNull) |
|
213 | - return new PhpXmlRpc\Response(new Value(inner_findstate($b->scalarval()))); |
|
214 | - else |
|
215 | - return new PhpXmlRpc\Response(new Value(inner_findstate($a->scalarval()))); |
|
216 | -} |
|
212 | + if ($a->scalartyp() == Value::$xmlrpcNull) { |
|
213 | + return new PhpXmlRpc\Response(new Value(inner_findstate($b->scalarval()))); |
|
214 | + } else { |
|
215 | + return new PhpXmlRpc\Response(new Value(inner_findstate($a->scalarval()))); |
|
216 | + } |
|
217 | + } |
|
217 | 218 | |
218 | 219 | $addtwo_sig = array(array(Value::$xmlrpcInt, Value::$xmlrpcInt, Value::$xmlrpcInt)); |
219 | 220 | $addtwo_doc = 'Add two integers together and return the result'; |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | die(); |
16 | 16 | } |
17 | 17 | |
18 | -include_once __DIR__ . "/../../vendor/autoload.php"; |
|
18 | +include_once __DIR__."/../../vendor/autoload.php"; |
|
19 | 19 | |
20 | 20 | // out-of-band information: let the client manipulate the server operations. |
21 | 21 | // we do this to help the testsuite script: do not reproduce in production! |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | mkdir($GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY']); |
26 | 26 | } |
27 | 27 | |
28 | - include_once __DIR__ . "/../../vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumCommon/prepend.php"; |
|
28 | + include_once __DIR__."/../../vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumCommon/prepend.php"; |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | use PhpXmlRpc\Value; |
@@ -122,11 +122,11 @@ discard block |
||
122 | 122 | // extract the value of the state number |
123 | 123 | $snv = $sno->scalarval(); |
124 | 124 | // look it up in our array (zero-based) |
125 | - if (isset($stateNames[$snv - 1])) { |
|
126 | - $stateName = $stateNames[$snv - 1]; |
|
125 | + if (isset($stateNames[$snv-1])) { |
|
126 | + $stateName = $stateNames[$snv-1]; |
|
127 | 127 | } else { |
128 | 128 | // not there, so complain |
129 | - $err = "I don't have a state for the index '" . $snv . "'"; |
|
129 | + $err = "I don't have a state for the index '".$snv."'"; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | // if we generated an error, create an error return response |
@@ -152,11 +152,11 @@ discard block |
||
152 | 152 | { |
153 | 153 | global $stateNames; |
154 | 154 | |
155 | - if (isset($stateNames[$stateNo - 1])) { |
|
156 | - return $stateNames[$stateNo - 1]; |
|
155 | + if (isset($stateNames[$stateNo-1])) { |
|
156 | + return $stateNames[$stateNo-1]; |
|
157 | 157 | } else { |
158 | 158 | // not, there so complain |
159 | - throw new Exception("I don't have a state for the index '" . $stateNo . "'", PhpXmlRpc\PhpXmlRpc::$xmlrpcerruser); |
|
159 | + throw new Exception("I don't have a state for the index '".$stateNo."'", PhpXmlRpc\PhpXmlRpc::$xmlrpcerruser); |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | |
@@ -186,17 +186,17 @@ discard block |
||
186 | 186 | eval($findstate9_sig['source']); |
187 | 187 | |
188 | 188 | $findstate10_sig = array( |
189 | - "function" => function ($req) { return findState($req); }, |
|
189 | + "function" => function($req) { return findState($req); }, |
|
190 | 190 | "signature" => $findstate_sig, |
191 | 191 | "docstring" => $findstate_doc, |
192 | 192 | ); |
193 | 193 | |
194 | -$findstate11_sig = $wrapper->wrapPhpFunction(function ($stateNo) { return inner_findstate($stateNo); }); |
|
194 | +$findstate11_sig = $wrapper->wrapPhpFunction(function($stateNo) { return inner_findstate($stateNo); }); |
|
195 | 195 | |
196 | 196 | $c = new xmlrpcServerMethodsContainer; |
197 | 197 | $moreSignatures = $wrapper->wrapPhpClass($c, array('prefix' => 'tests.', 'method_type' => 'all')); |
198 | 198 | |
199 | -$returnObj_sig = $wrapper->wrapPhpFunction(array($c, 'returnObject'), '', array('encode_php_objs' => true)); |
|
199 | +$returnObj_sig = $wrapper->wrapPhpFunction(array($c, 'returnObject'), '', array('encode_php_objs' => true)); |
|
200 | 200 | |
201 | 201 | // used to test signatures with NULL params |
202 | 202 | $findstate12_sig = array( |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | $s = $req->getParam(0); |
223 | 223 | $t = $req->getParam(1); |
224 | 224 | |
225 | - return new PhpXmlRpc\Response(new Value($s->scalarval() + $t->scalarval(), Value::$xmlrpcInt)); |
|
225 | + return new PhpXmlRpc\Response(new Value($s->scalarval()+$t->scalarval(), Value::$xmlrpcInt)); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | $addtwodouble_sig = array(array(Value::$xmlrpcDouble, Value::$xmlrpcDouble, Value::$xmlrpcDouble)); |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | $s = $req->getParam(0); |
233 | 233 | $t = $req->getParam(1); |
234 | 234 | |
235 | - return new PhpXmlRpc\Response(new Value($s->scalarval() + $t->scalarval(), Value::$xmlrpcDouble)); |
|
235 | + return new PhpXmlRpc\Response(new Value($s->scalarval()+$t->scalarval(), Value::$xmlrpcDouble)); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | $stringecho_sig = array(array(Value::$xmlrpcString, Value::$xmlrpcString)); |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | function echoBack($req) |
249 | 249 | { |
250 | 250 | // just sends back a string with what i got sent to me, just escaped, that's all |
251 | - $s = "I got the following message:\n" . $req->serialize(); |
|
251 | + $s = "I got the following message:\n".$req->serialize(); |
|
252 | 252 | |
253 | 253 | return new PhpXmlRpc\Response(new Value($s)); |
254 | 254 | } |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | return 0; |
306 | 306 | } |
307 | 307 | |
308 | - return ($agesorter_arr[$a] > $agesorter_arr[$b]) ? -1 : 1; |
|
308 | + return ($agesorter_arr[$a]>$agesorter_arr[$b]) ? -1 : 1; |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | $agesorter_sig = array(array(Value::$xmlrpcArray, Value::$xmlrpcArray)); |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | // hack, must make global as uksort() won't |
352 | 352 | // allow us to pass any other auxiliary information |
353 | 353 | uksort($agesorter_arr, 'agesorter_compare'); |
354 | - foreach($agesorter_arr as $key => $val) { |
|
354 | + foreach ($agesorter_arr as $key => $val) { |
|
355 | 355 | // recreate each struct element |
356 | 356 | $v[] = new Value( |
357 | 357 | array( |
@@ -406,17 +406,17 @@ discard block |
||
406 | 406 | $err = "Error, no 'From' field specified"; |
407 | 407 | } |
408 | 408 | |
409 | - $msgHdr = "From: " . $mFrom->scalarval() . "\n"; |
|
410 | - $msgHdr .= "To: " . $mTo->scalarval() . "\n"; |
|
409 | + $msgHdr = "From: ".$mFrom->scalarval()."\n"; |
|
410 | + $msgHdr .= "To: ".$mTo->scalarval()."\n"; |
|
411 | 411 | |
412 | 412 | if ($mCc->scalarval() != "") { |
413 | - $msgHdr .= "Cc: " . $mCc->scalarval() . "\n"; |
|
413 | + $msgHdr .= "Cc: ".$mCc->scalarval()."\n"; |
|
414 | 414 | } |
415 | 415 | if ($mBcc->scalarval() != "") { |
416 | - $msgHdr .= "Bcc: " . $mBcc->scalarval() . "\n"; |
|
416 | + $msgHdr .= "Bcc: ".$mBcc->scalarval()."\n"; |
|
417 | 417 | } |
418 | 418 | if ($mMime->scalarval() != "") { |
419 | - $msgHdr .= "Content-type: " . $mMime->scalarval() . "\n"; |
|
419 | + $msgHdr .= "Content-type: ".$mMime->scalarval()."\n"; |
|
420 | 420 | } |
421 | 421 | $msgHdr .= "X-Mailer: XML-RPC for PHP mailer 1.0"; |
422 | 422 | |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | $moe = $sno["moe"]; |
507 | 507 | $larry = $sno["larry"]; |
508 | 508 | $curly = $sno["curly"]; |
509 | - $num = $moe->scalarval() + $larry->scalarval() + $curly->scalarval(); |
|
509 | + $num = $moe->scalarval()+$larry->scalarval()+$curly->scalarval(); |
|
510 | 510 | |
511 | 511 | return new PhpXmlRpc\Response(new Value($num, Value::$xmlrpcInt)); |
512 | 512 | } |
@@ -548,9 +548,9 @@ discard block |
||
548 | 548 | $ar = $req->getParam(0); |
549 | 549 | $sz = $ar->count(); |
550 | 550 | $first = $ar[0]; |
551 | - $last = $ar[$sz - 1]; |
|
551 | + $last = $ar[$sz-1]; |
|
552 | 552 | |
553 | - return new PhpXmlRpc\Response(new Value($first->scalarval() . |
|
553 | + return new PhpXmlRpc\Response(new Value($first->scalarval(). |
|
554 | 554 | $last->scalarval(), Value::$xmlrpcString)); |
555 | 555 | } |
556 | 556 | |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | $larry = $fools["larry"]; |
585 | 585 | $moe = $fools["moe"]; |
586 | 586 | |
587 | - return new PhpXmlRpc\Response(new Value($curly->scalarval() + $larry->scalarval() + $moe->scalarval(), Value::$xmlrpcInt)); |
|
587 | + return new PhpXmlRpc\Response(new Value($curly->scalarval()+$larry->scalarval()+$moe->scalarval(), Value::$xmlrpcInt)); |
|
588 | 588 | } |
589 | 589 | |
590 | 590 | $v1_countTheEntities_sig = array(array(Value::$xmlrpcStruct, Value::$xmlrpcString)); |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | $ap = 0; |
599 | 599 | $qu = 0; |
600 | 600 | $amp = 0; |
601 | - for ($i = 0; $i < strlen($str); $i++) { |
|
601 | + for ($i = 0; $i<strlen($str); $i++) { |
|
602 | 602 | $c = substr($str, $i, 1); |
603 | 603 | switch ($c) { |
604 | 604 | case ">": |
@@ -800,7 +800,7 @@ discard block |
||
800 | 800 | ), |
801 | 801 | // Greek word 'kosme'. NB: NOT a valid ISO8859 string! |
802 | 802 | // NB: we can only register this when setting internal encoding to UTF-8, or it will break system.listMethods |
803 | - "tests.utf8methodname." . 'κόσμε' => array( |
|
803 | + "tests.utf8methodname.".'κόσμε' => array( |
|
804 | 804 | "function" => "stringEcho", |
805 | 805 | "signature" => $stringecho_sig, |
806 | 806 | "docstring" => $stringecho_doc, |
@@ -996,5 +996,5 @@ discard block |
||
996 | 996 | // Out-of-band information: let the client manipulate the server operations. |
997 | 997 | // We do this to help the testsuite script: do not reproduce in production! |
998 | 998 | if (isset($_COOKIE['PHPUNIT_SELENIUM_TEST_ID']) && extension_loaded('xdebug')) { |
999 | - include_once __DIR__ . "/../../vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumCommon/append.php"; |
|
999 | + include_once __DIR__."/../../vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumCommon/append.php"; |
|
1000 | 1000 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * @license code licensed under the BSD License: see file license.txt |
10 | 10 | */ |
11 | 11 | |
12 | -include_once __DIR__ . "/../../src/Autoloader.php"; |
|
12 | +include_once __DIR__."/../../src/Autoloader.php"; |
|
13 | 13 | PhpXmlRpc\Autoloader::register(); |
14 | 14 | |
15 | 15 | /** |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $url = $encoder->decode($req->getParam(0)); |
31 | 31 | $client = new PhpXmlRpc\Client($url); |
32 | 32 | |
33 | - if ($req->getNumParams() > 3) { |
|
33 | + if ($req->getNumParams()>3) { |
|
34 | 34 | // we have to set some options onto the client. |
35 | 35 | // Note that if we do not untaint the received values, warnings might be generated... |
36 | 36 | $options = $encoder->decode($req->getParam(3)); |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $client->setSSLVerifyPeer($val); |
51 | 51 | break; |
52 | 52 | case 'Timeout': |
53 | - $timeout = (integer)$val; |
|
53 | + $timeout = (integer) $val; |
|
54 | 54 | break; |
55 | 55 | } // switch |
56 | 56 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | // add debug info into response we give back to caller |
71 | - PhpXmlRpc\Server::xmlrpc_debugmsg("Sending to server $url the payload: " . $req->serialize()); |
|
71 | + PhpXmlRpc\Server::xmlrpc_debugmsg("Sending to server $url the payload: ".$req->serialize()); |
|
72 | 72 | |
73 | 73 | return $client->send($req, $timeout); |
74 | 74 | } |
@@ -12,14 +12,14 @@ discard block |
||
12 | 12 | </h3> |
13 | 13 | <?php |
14 | 14 | |
15 | -include_once __DIR__ . "/../../src/Autoloader.php"; |
|
15 | +include_once __DIR__."/../../src/Autoloader.php"; |
|
16 | 16 | PhpXmlRpc\Autoloader::register(); |
17 | 17 | |
18 | 18 | $client = new PhpXmlRpc\Client("http://phpxmlrpc.sourceforge.net/server.php"); |
19 | 19 | $client->return_type = 'phpvals'; // let client give us back php values instead of xmlrpcvals |
20 | 20 | $resp = $client->send(new PhpXmlRpc\Request('system.listMethods')); |
21 | 21 | if ($resp->faultCode()) { |
22 | - echo "<p>Server methods list could not be retrieved: error {$resp->faultCode()} '" . htmlspecialchars($resp->faultString()) . "'</p>\n"; |
|
22 | + echo "<p>Server methods list could not be retrieved: error {$resp->faultCode()} '".htmlspecialchars($resp->faultString())."'</p>\n"; |
|
23 | 23 | } else { |
24 | 24 | echo "<p>Server methods list retrieved, now wrapping it up...</p>\n<ul>\n"; |
25 | 25 | flush(); |
@@ -31,9 +31,9 @@ discard block |
||
31 | 31 | if ($methodName == 'examples.getStateName') { |
32 | 32 | $callable = $wrapper->wrapXmlrpcMethod($client, $methodName); |
33 | 33 | if ($callable) { |
34 | - echo "<li>Remote server method " . htmlspecialchars($methodName) . " wrapped into php function</li>\n"; |
|
34 | + echo "<li>Remote server method ".htmlspecialchars($methodName)." wrapped into php function</li>\n"; |
|
35 | 35 | } else { |
36 | - echo "<li>Remote server method " . htmlspecialchars($methodName) . " could not be wrapped!</li>\n"; |
|
36 | + echo "<li>Remote server method ".htmlspecialchars($methodName)." could not be wrapped!</li>\n"; |
|
37 | 37 | } |
38 | 38 | break; |
39 | 39 | } |