You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

RemoteAliasTest.php 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /**
  3. * Test for Postfixadmin
  4. *
  5. * @package tests
  6. */
  7. require_once('RemoteTest.php');
  8. class RemoteAliasTest extends RemoteTest {
  9. public function __construct() {
  10. parent::__construct();
  11. global $CONF;
  12. }
  13. /**
  14. * Adds the test recipient data to the database.
  15. */
  16. public function setUp() {
  17. parent::setUp();
  18. }
  19. public function tearDown() {
  20. parent::tearDown();
  21. }
  22. public function testGet() {
  23. try {
  24. /* although we created an alias record, for users, this isn't returned... */
  25. $this->assertEqual($this->alias->get(), array());
  26. } catch (Exception $e) {
  27. var_dump($this->xmlrpc_client->getHttpClient()->getLastResponse()->getBody());
  28. }
  29. }
  30. public function testHasStoreAndForward() {
  31. $this->assertTrue($this->alias->hasStoreAndForward());
  32. }
  33. public function testUpdateRemoteOnly() {
  34. $this->assertTrue($this->alias->update(array('roger@rabbit.com'), 'remote_only'));
  35. $this->assertFalse($this->alias->hasStoreAndForward());
  36. $this->assertTrue($this->alias->update(array('roger@rabbit.com'), 'remote_only'));
  37. $this->assertTrue($this->alias->update(array('roger@rabbit.com', 'fish@fish.net', 'road@runner.com'), 'remote_only'));
  38. $this->assertEqual($this->alias->get(), array('roger@rabbit.com', 'fish@fish.net', 'road@runner.com'));
  39. $this->assertFalse($this->alias->hasStoreAndForward());
  40. }
  41. public function testUpdateForwardandStore() {
  42. $orig_aliases = $this->alias->get();
  43. if (!is_array($orig_aliases)) {
  44. $orig_aliases = array();
  45. }
  46. $orig_aliases[] = 'roger@robbit.com';
  47. $this->assertTrue($this->alias->update($orig_aliases, 'forward_and_store'));
  48. $this->assertEqual($this->alias->get(), $orig_aliases);
  49. $this->assertTrue($this->alias->update(array($this->username), 'forward_and_store'));
  50. $this->assertEqual($this->alias->get(), array());
  51. }
  52. }
  53. /* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */