File: RemoteTest.php

package info (click to toggle)
postfixadmin 4.0.1%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,888 kB
  • sloc: php: 12,256; perl: 1,156; sh: 717; python: 142; xml: 63; sql: 3; makefile: 2
file content (41 lines) | stat: -rw-r--r-- 1,264 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php

abstract class RemoteTest extends \PHPUnit\Framework\TestCase
{
    protected $server_url = 'http://change.me/to/work'; // http://orange/david/postfixadmin/xmlrpc.php';
    protected $username = 'user@example.com';
    protected $password = 'password1';

    /* xmlrpc objects... */
    protected $user;
    protected $vacation;
    protected $alias;

    protected $xmlrpc_client;

    public function setUp(): void
    {
        parent::setUp();

        if ($this->server_url == 'http://change.me/to/work') {
            $this->markTestSkipped("Test skipped; Configuration change to \$this->server_url required");
        }

        if (!class_exists('Zend_XmlRpc_Client', true)) {
            $this->markTestSkipped("Test skipped; Zend_XmlRpc_Client not found");
        }

        $this->xmlrpc_client = new Zend_XmlRpc_Client($this->server_url);
        $http_client = $this->xmlrpc_client->getHttpClient();
        $http_client->setCookieJar();

        $login_object = $this->xmlrpc_client->getProxy('login');
        $success = $login_object->login($this->username, $this->password);

        if (!$success) {
            die("Failed to login to xmlrpc interface");
        }
    }
}

/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */