0
0
mirror of https://github.com/postfixadmin/postfixadmin.git synced 2024-09-19 19:22:14 +02:00
postfixadmin/tests/RemoteVacationTest.php

68 lines
2.0 KiB
PHP
Raw Normal View History

<?php
/**
* Test for Postfixadmin - remote vacation stuff
*
* @package tests
*/
require_once('RemoteTest.php');
2021-03-22 10:28:28 +01:00
class RemoteVacationTest extends RemoteTest
{
/**
* Adds the test recipient data to the database.
*/
2022-06-28 14:46:11 +02:00
public function setUp(): void
2021-04-13 22:19:16 +02:00
{
// 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();
}
2021-04-13 22:19:16 +02:00
public function testIsVacationSupported()
{
$this->assertTrue($this->vacation->isVacationSupported());
}
2021-04-13 22:19:16 +02:00
public function testCheckVacation()
{
$this->assertFalse($this->vacation->checkVacation());
}
2021-04-13 22:19:16 +02:00
public function testGetDetails()
{
$details = $this->vacation->getDetails();
$this->assertFalse($details); // empty by default (thanks to tearDown/setUp);
2018-01-26 15:45:57 +01:00
}
2021-04-13 22:19:16 +02:00
public function testSetAway()
{
$this->assertFalse($this->vacation->checkVacation());
$this->assertTrue($this->vacation->setAway('zzzz', 'aaaa'));
$this->assertTrue($this->vacation->checkVacation());
$details = $this->vacation->getDetails();
$this->assertEquals($details['subject'], 'zzzz');
$this->assertEquals($details['body'], 'aaaa');
$this->vacation->remove();
$details = $this->vacation->getDetails();
$this->assertEquals($details['subject'], 'zzzz');
$this->assertEquals($details['body'], 'aaaa');
$this->vacation->setAway('subject', 'body');
$details = $this->vacation->getDetails();
$this->assertEquals($details['subject'], 'subject');
$this->assertEquals($details['body'], 'body');
}
}
/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */