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'); |
|
|
|
|
15
|
|
|
} |
16
|
|
|
|
17
|
|
|
// *** client *** |
18
|
|
|
|
19
|
|
|
public function testAgeSort() |
20
|
|
|
{ |
21
|
|
|
$page = $this->request('?demo=client/agesort.php'); |
|
|
|
|
22
|
|
|
} |
23
|
|
|
|
24
|
|
|
public function testCodegen() |
25
|
|
|
{ |
26
|
|
|
$page = $this->request('?demo=client/codegen.php'); |
|
|
|
|
27
|
|
|
} |
28
|
|
|
|
29
|
|
|
public function testGetStateName() |
30
|
|
|
{ |
31
|
|
|
$page = $this->request('?demo=client/getstatename.php'); |
|
|
|
|
32
|
|
|
$page = $this->request('?demo=client/getstatename.php', 'POST', array('stateno' => '1')); |
|
|
|
|
33
|
|
|
} |
34
|
|
|
|
35
|
|
|
public function testLoggerInjection() |
36
|
|
|
{ |
37
|
|
|
$page = $this->request('?demo=client/loggerinjection.php'); |
|
|
|
|
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
public function testIntrospect() |
41
|
|
|
{ |
42
|
|
|
$page = $this->request('?demo=client/introspect.php'); |
|
|
|
|
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
public function testParallel() |
46
|
|
|
{ |
47
|
|
|
$page = $this->request('?demo=client/parallel.php'); |
|
|
|
|
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
public function testProxy() |
51
|
|
|
{ |
52
|
|
|
$page = $this->request('?demo=client/proxy.php', 'GET', null, true); |
|
|
|
|
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
public function testWhich() |
56
|
|
|
{ |
57
|
|
|
$page = $this->request('?demo=client/which.php'); |
|
|
|
|
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
public function testWindowsCharset() |
61
|
|
|
{ |
62
|
|
|
$page = $this->request('?demo=client/windowscharset.php'); |
|
|
|
|
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
public function testWrap() |
66
|
|
|
{ |
67
|
|
|
$page = $this->request('?demo=client/wrap.php'); |
|
|
|
|
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); |
|
|
|
|
76
|
|
|
$this->assertRegexp('#<int>10(5|3)</int>#', $page); |
|
|
|
|
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); |
|
|
|
|
89
|
|
|
$this->assertRegexp('#<int>10(5|3)</int>#', $page); |
|
|
|
|
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())); |
|
|
|
|
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); |
|
|
|
|
114
|
|
|
$this->assertRegexp('#<int>10(5|3)</int>#', $page); |
|
|
|
|
115
|
|
|
} |
116
|
|
|
} |
117
|
|
|
|