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.4KB

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