Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

RemoteVacationTest.php 2.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. /**
  3. * Test for Postfixadmin - remote vacation stuff
  4. *
  5. * @package tests
  6. */
  7. require_once('RemoteTest.php');
  8. class RemoteVacationTest extends RemoteTest {
  9. public function __construct() {
  10. parent::__construct();
  11. global $CONF;
  12. // Ensure config.inc.php is vaguely correct.
  13. if($CONF['vacation'] != 'YES' || $CONF['vacation_control'] != "YES") {
  14. die("Cannot run tests; vacation not enabled - see config.inc.php");
  15. }
  16. if($CONF['vacation_domain'] != 'autoreply.example.com') {
  17. die("Cannot run tests; vacation_domain is not set to autoreply.example.com - see config.inc.php");
  18. }
  19. }
  20. /**
  21. * Adds the test recipient data to the database.
  22. */
  23. public function setUp() {
  24. parent::setUp();
  25. }
  26. public function tearDown() {
  27. parent::tearDown();
  28. }
  29. public function testIsVacationSupported() {
  30. try {
  31. $this->assertTrue($this->vacation->isVacationSupported());
  32. }
  33. catch(Exception $e){
  34. var_dump($e);
  35. var_dump($this->xmlrpc_client->getHttpClient()->getLastResponse()->getBody());
  36. die("fail..");
  37. }
  38. }
  39. public function testCheckVacation() {
  40. $this->assertFalse($this->vacation->checkVacation());
  41. }
  42. public function testGetDetails() {
  43. $details = $this->vacation->getDetails();
  44. $this->assertFalse($details); // empty by default (thansk to tearDown/setUp);
  45. }
  46. public function testSetAway() {
  47. try {
  48. $this->assertFalse($this->vacation->checkVacation());
  49. $this->assertTrue($this->vacation->setAway('zzzz', 'aaaa'));
  50. $this->assertTrue($this->vacation->checkVacation());
  51. }
  52. catch(Exception $e) {
  53. var_dump($this->xmlrpc_client->getHttpClient()->getLastResponse()->getBody());
  54. }
  55. $details = $this->vacation->getDetails();
  56. $this->assertEqual($details['subject'], 'zzzz');
  57. $this->assertEqual($details['body'], 'aaaa');
  58. $this->vacation->remove();
  59. $details = $this->vacation->getDetails();
  60. $this->assertEqual($details['subject'], 'zzzz');
  61. $this->assertEqual($details['body'], 'aaaa');
  62. $this->vacation->setAway('subject', 'body');
  63. $details = $this->vacation->getDetails();
  64. $this->assertEqual($details['subject'], 'subject');
  65. $this->assertEqual($details['body'], 'body');
  66. }
  67. }
  68. /* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */