File: RemoteAliasTest.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 (54 lines) | stat: -rw-r--r-- 1,759 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
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php

/**
 * Test for Postfixadmin
 *
 * @package tests
 */

require_once('RemoteTest.php');

class RemoteAliasTest extends RemoteTest
{
    public function __construct()
    {
        parent::__construct();
        global $CONF;
    }

    public function testGet()
    {
        /* although we created an alias record, for users, this isn't returned... */
        $this->assertEquals($this->alias->get(), array());
    }

    public function testHasStoreAndForward()
    {
        $this->assertTrue($this->alias->hasStoreAndForward());
    }

    public function testUpdateRemoteOnly()
    {
        $this->assertTrue($this->alias->update(array('roger@rabbit.com'), 'remote_only'));
        $this->assertFalse($this->alias->hasStoreAndForward());
        $this->assertTrue($this->alias->update(array('roger@rabbit.com'), 'remote_only'));
        $this->assertTrue($this->alias->update(array('roger@rabbit.com', 'fish@fish.net', 'road@runner.com'), 'remote_only'));
        $this->assertEquals($this->alias->get(), array('roger@rabbit.com', 'fish@fish.net', 'road@runner.com'));
        $this->assertFalse($this->alias->hasStoreAndForward());
    }

    public function testUpdateForwardandStore()
    {
        $orig_aliases = $this->alias->get();
        if (!is_array($orig_aliases)) {
            $orig_aliases = array();
        }
        $orig_aliases[] = 'roger@robbit.com';
        $this->assertTrue($this->alias->update($orig_aliases, 'forward_and_store'));
        $this->assertEquals($this->alias->get(), $orig_aliases);
        $this->assertTrue($this->alias->update(array($this->username), 'forward_and_store'));
        $this->assertEquals($this->alias->get(), array());
    }
}

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