1 | <?php |
||||
2 | |||||
3 | include_once __DIR__ . '/WebTestCase.php'; |
||||
4 | |||||
5 | /** |
||||
6 | * Tests for php files in the 'demo' directory. |
||||
7 | * |
||||
8 | * @todo add execution of perl and python demos via usage of 'exec' |
||||
9 | */ |
||||
10 | class DemoFilesTest extends PhpXmlRpc_WebTestCase |
||||
11 | { |
||||
12 | public function testVardemo() |
||||
13 | { |
||||
14 | $page = $this->request('?demo=vardemo.php'); |
||||
0 ignored issues
–
show
Unused Code
introduced
by
![]() |
|||||
15 | } |
||||
16 | |||||
17 | // *** client *** |
||||
18 | |||||
19 | public function testAgeSort() |
||||
20 | { |
||||
21 | $page = $this->request('?demo=client/agesort.php'); |
||||
0 ignored issues
–
show
|
|||||
22 | } |
||||
23 | |||||
24 | public function testCodegen() |
||||
25 | { |
||||
26 | $page = $this->request('?demo=client/codegen.php'); |
||||
0 ignored issues
–
show
|
|||||
27 | } |
||||
28 | |||||
29 | public function testGetStateName() |
||||
30 | { |
||||
31 | $page = $this->request('?demo=client/getstatename.php'); |
||||
0 ignored issues
–
show
|
|||||
32 | $page = $this->request('?demo=client/getstatename.php', 'POST', array('stateno' => '1')); |
||||
0 ignored issues
–
show
array('stateno' => '1') of type array<string,string> is incompatible with the type string expected by parameter $payload of PhpXmlRpc_WebTestCase::request() .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
33 | } |
||||
34 | |||||
35 | public function testLoggerInjection() |
||||
36 | { |
||||
37 | $page = $this->request('?demo=client/loggerinjection.php'); |
||||
0 ignored issues
–
show
|
|||||
38 | } |
||||
39 | |||||
40 | public function testIntrospect() |
||||
41 | { |
||||
42 | $page = $this->request('?demo=client/introspect.php'); |
||||
0 ignored issues
–
show
|
|||||
43 | } |
||||
44 | |||||
45 | public function testParallel() |
||||
46 | { |
||||
47 | $page = $this->request('?demo=client/parallel.php'); |
||||
0 ignored issues
–
show
|
|||||
48 | } |
||||
49 | |||||
50 | public function testProxy() |
||||
51 | { |
||||
52 | $page = $this->request('?demo=client/proxy.php', 'GET', null, true); |
||||
0 ignored issues
–
show
|
|||||
53 | } |
||||
54 | |||||
55 | public function testWhich() |
||||
56 | { |
||||
57 | $page = $this->request('?demo=client/which.php'); |
||||
0 ignored issues
–
show
|
|||||
58 | } |
||||
59 | |||||
60 | public function testWindowsCharset() |
||||
61 | { |
||||
62 | $page = $this->request('?demo=client/windowscharset.php'); |
||||
0 ignored issues
–
show
|
|||||
63 | } |
||||
64 | |||||
65 | public function testWrap() |
||||
66 | { |
||||
67 | $page = $this->request('?demo=client/wrap.php'); |
||||
0 ignored issues
–
show
|
|||||
68 | } |
||||
69 | |||||
70 | // *** servers *** |
||||
71 | |||||
72 | public function testCodegenServer() |
||||
73 | { |
||||
74 | $page = $this->request('?demo=server/codegen.php'); |
||||
75 | $this->assertStringContainsString('<name>faultCode</name>', $page); |
||||
0 ignored issues
–
show
It seems like
$page can also be of type true ; however, parameter $haystack of PHPUnit\Framework\Assert...tStringContainsString() does only seem to accept string , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
76 | $this->assertRegexp('#<int>10(5|3)</int>#', $page); |
||||
0 ignored issues
–
show
It seems like
$page can also be of type true ; however, parameter $string of PHPUnit\Framework\Assert::assertRegExp() does only seem to accept string , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
77 | |||||
78 | $c = $this->newClient('?demo=server/codegen.php'); |
||||
79 | $r = $c->send(new \PhpXmlRpc\Request('CommentManager.getComments', array( |
||||
80 | new \PhpXmlRpc\Value('aCommentId') |
||||
81 | ))); |
||||
82 | $this->assertEquals(0, $r->faultCode()); |
||||
83 | } |
||||
84 | |||||
85 | public function testDiscussServer() |
||||
86 | { |
||||
87 | $page = $this->request('?demo=server/discuss.php'); |
||||
88 | $this->assertStringContainsString('<name>faultCode</name>', $page); |
||||
0 ignored issues
–
show
It seems like
$page can also be of type true ; however, parameter $haystack of PHPUnit\Framework\Assert...tStringContainsString() does only seem to accept string , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
89 | $this->assertRegexp('#<int>10(5|3)</int>#', $page); |
||||
0 ignored issues
–
show
It seems like
$page can also be of type true ; however, parameter $string of PHPUnit\Framework\Assert::assertRegExp() does only seem to accept string , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
90 | |||||
91 | $c = $this->newClient('?demo=server/discuss.php'); |
||||
92 | |||||
93 | $r = $c->send(new \PhpXmlRpc\Request('discuss.addComment', array( |
||||
94 | new \PhpXmlRpc\Value('aCommentId'), |
||||
95 | new \PhpXmlRpc\Value('aCommentUser'), |
||||
96 | new \PhpXmlRpc\Value('a Comment') |
||||
97 | ))); |
||||
98 | $this->assertEquals(0, $r->faultCode()); |
||||
99 | $this->assertGreaterThanOrEqual(1, $r->value()->scalarval()); |
||||
100 | |||||
101 | $r = $c->send(new \PhpXmlRpc\Request('discuss.getComments', array( |
||||
102 | new \PhpXmlRpc\Value('aCommentId') |
||||
103 | ))); |
||||
104 | $this->assertEquals(0, $r->faultCode()); |
||||
105 | $this->assertEquals(0, $r->faultCode()); |
||||
106 | $this->assertGreaterThanOrEqual(1, count($r->value())); |
||||
0 ignored issues
–
show
It seems like
$r->value() can also be of type string ; however, parameter $value of count() does only seem to accept Countable|array , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
107 | } |
||||
108 | |||||
109 | public function testProxyServer() |
||||
110 | { |
||||
111 | /// @todo add a couple of proper xmlrpc calls, too |
||||
112 | $page = $this->request('?demo=server/proxy.php'); |
||||
113 | $this->assertStringContainsString('<name>faultCode</name>', $page); |
||||
0 ignored issues
–
show
It seems like
$page can also be of type true ; however, parameter $haystack of PHPUnit\Framework\Assert...tStringContainsString() does only seem to accept string , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
114 | $this->assertRegexp('#<int>10(5|3)</int>#', $page); |
||||
0 ignored issues
–
show
It seems like
$page can also be of type true ; however, parameter $string of PHPUnit\Framework\Assert::assertRegExp() does only seem to accept string , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
115 | } |
||||
116 | } |
||||
117 |