123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <?php
- /**
- * Test for Postfixadmin - remote vacation stuff
- *
- * @package tests
- */
-
- require_once('RemoteTest.php');
-
- class RemoteVacationTest extends RemoteTest {
-
-
- /**
- * Adds the test recipient data to the database.
- */
- public function setUp() {
- // Ensure config.inc.php is vaguely correct.
- global $CONF;
- if ($CONF['vacation'] != 'YES' || $CONF['vacation_control'] != "YES") {
- $this->markTestSkipped("Cannot run tests; vacation not enabled - see config.inc.php");
- }
- if ($CONF['vacation_domain'] != 'autoreply.example.com') {
- $this->markTestSkipped("Cannot run tests; vacation_domain is not set to autoreply.example.com - see config.inc.php");
- }
- parent::setUp();
- }
-
- public function testIsVacationSupported() {
- try {
- $this->assertTrue($this->vacation->isVacationSupported());
- } catch (Exception $e) {
- var_dump($e);
- var_dump($this->xmlrpc_client->getHttpClient()->getLastResponse()->getBody());
- die("fail..");
- }
- }
-
- public function testCheckVacation() {
- $this->assertFalse($this->vacation->checkVacation());
- }
-
-
- public function testGetDetails() {
- $details = $this->vacation->getDetails();
- $this->assertFalse($details); // empty by default (thansk to tearDown/setUp);
- }
-
- public function testSetAway() {
- try {
- $this->assertFalse($this->vacation->checkVacation());
- $this->assertTrue($this->vacation->setAway('zzzz', 'aaaa'));
- $this->assertTrue($this->vacation->checkVacation());
- } catch (Exception $e) {
- var_dump($this->xmlrpc_client->getHttpClient()->getLastResponse()->getBody());
- }
- $details = $this->vacation->getDetails();
- $this->assertEqual($details['subject'], 'zzzz');
- $this->assertEqual($details['body'], 'aaaa');
-
- $this->vacation->remove();
- $details = $this->vacation->getDetails();
- $this->assertEqual($details['subject'], 'zzzz');
- $this->assertEqual($details['body'], 'aaaa');
-
- $this->vacation->setAway('subject', 'body');
- $details = $this->vacation->getDetails();
- $this->assertEqual($details['subject'], 'subject');
- $this->assertEqual($details['body'], 'body');
- }
- }
-
- /* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */
|