Passed
Push — master ( 58f541...1409f2 )
by Gaetano
05:15
created

DemoFilesTest::testDiscussServer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 6
rs 10
1
<?php
2
3
include_once __DIR__ . '/WebTestCase.php';
4
5
/**
6
 * Tests for php files in the 'demo' directory
7
 */
8
class DemoFilesTest extends PhpXmlRpc_WebTestCase
9
{
10
    public function set_up()
11
    {
12
        $this->args = argParser::getArgs();
13
14
        $this->baseUrl = $this->args['HTTPSERVER'] . str_replace( '/demo/server/server.php', '/demo/', $this->args['HTTPURI'] );
15
16
        $this->coverageScriptUrl = 'http://' . $this->args['HTTPSERVER'] . '/' . str_replace( '/demo/server/server.php', 'tests/phpunit_coverage.php', $this->args['HTTPURI'] );
17
    }
18
19
    public function testAgeSort()
20
    {
21
        $page = $this->request('client/agesort.php');
0 ignored issues
show
Unused Code introduced by
The assignment to $page is dead and can be removed.
Loading history...
22
    }
23
24
    public function testGetStateName()
25
    {
26
        $page = $this->request('client/getstatename.php');
0 ignored issues
show
Unused Code introduced by
The assignment to $page is dead and can be removed.
Loading history...
27
        $page = $this->request('client/getstatename.php', 'POST', array('stateno' => '1'));
0 ignored issues
show
Bug introduced by
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 ignore-type  annotation

27
        $page = $this->request('client/getstatename.php', 'POST', /** @scrutinizer ignore-type */ array('stateno' => '1'));
Loading history...
28
    }
29
30
    public function testIntrospect()
31
    {
32
        $page = $this->request('client/introspect.php');
0 ignored issues
show
Unused Code introduced by
The assignment to $page is dead and can be removed.
Loading history...
33
    }
34
35
    public function testMail()
36
    {
37
        $page = $this->request('client/mail.php');
0 ignored issues
show
Unused Code introduced by
The assignment to $page is dead and can be removed.
Loading history...
38
        $page = $this->request('client/mail.php', 'POST', array(
0 ignored issues
show
Bug introduced by
array('mailto' => '', 'm...=> '', 'mailbcc' => '') 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 ignore-type  annotation

38
        $page = $this->request('client/mail.php', 'POST', /** @scrutinizer ignore-type */ array(
Loading history...
39
            "mailto" => '',
40
            "mailsub" => '',
41
            "mailmsg" => '',
42
            "mailfrom" => '',
43
            "mailcc" => '',
44
            "mailbcc" => '',
45
        ));
46
    }
47
48
    public function testParallel()
49
    {
50
        $page = $this->request('client/parallel.php');
0 ignored issues
show
Unused Code introduced by
The assignment to $page is dead and can be removed.
Loading history...
51
    }
52
53
    public function testProxy()
54
    {
55
        $page = $this->request('client/proxy.php', 'GET', null, true);
0 ignored issues
show
Unused Code introduced by
The assignment to $page is dead and can be removed.
Loading history...
56
    }
57
58
    public function testWhich()
59
    {
60
        $page = $this->request('client/which.php');
0 ignored issues
show
Unused Code introduced by
The assignment to $page is dead and can be removed.
Loading history...
61
    }
62
63
    public function testWrap()
64
    {
65
        $page = $this->request('client/wrap.php');
0 ignored issues
show
Unused Code introduced by
The assignment to $page is dead and can be removed.
Loading history...
66
    }
67
68
    public function testDiscussServer()
69
    {
70
        /// @todo add a couple of proper xmlrpc calls, too
71
        $page = $this->request('server/discuss.php');
72
        $this->assertStringContainsString('<name>faultCode</name>', $page);
0 ignored issues
show
Bug introduced by
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 ignore-type  annotation

72
        $this->assertStringContainsString('<name>faultCode</name>', /** @scrutinizer ignore-type */ $page);
Loading history...
73
        $this->assertRegexp('#<int>10(5|3)</int>#', $page);
0 ignored issues
show
Bug introduced by
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 ignore-type  annotation

73
        $this->assertRegexp('#<int>10(5|3)</int>#', /** @scrutinizer ignore-type */ $page);
Loading history...
74
    }
75
76
    public function testProxyServer()
77
    {
78
        /// @todo add a couple of proper xmlrpc calls, too
79
        $page = $this->request('server/proxy.php');
80
        $this->assertStringContainsString('<name>faultCode</name>', $page);
0 ignored issues
show
Bug introduced by
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 ignore-type  annotation

80
        $this->assertStringContainsString('<name>faultCode</name>', /** @scrutinizer ignore-type */ $page);
Loading history...
81
        $this->assertRegexp('#<int>10(5|3)</int>#', $page);
0 ignored issues
show
Bug introduced by
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 ignore-type  annotation

81
        $this->assertRegexp('#<int>10(5|3)</int>#', /** @scrutinizer ignore-type */ $page);
Loading history...
82
    }
83
}
84