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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. }
  27. catch(Exception $e) {
  28. var_dump($this->xmlrpc_client->getHttpClient()->getLastResponse()->getBody());
  29. }
  30. }
  31. public function testHasStoreAndForward() {
  32. $this->assertTrue($this->alias->hasStoreAndForward());
  33. }
  34. public function testUpdateRemoteOnly() {
  35. $this->assertTrue($this->alias->update(array('roger@rabbit.com'), 'remote_only'));
  36. $this->assertFalse($this->alias->hasStoreAndForward());
  37. $this->assertTrue($this->alias->update(array('roger@rabbit.com'), 'remote_only'));
  38. $this->assertTrue($this->alias->update(array('roger@rabbit.com', 'fish@fish.net', 'road@runner.com'), 'remote_only'));
  39. $this->assertEqual($this->alias->get(), array('roger@rabbit.com', 'fish@fish.net', 'road@runner.com'));
  40. $this->assertFalse($this->alias->hasStoreAndForward());
  41. }
  42. public function testUpdateForwardandStore() {
  43. $orig_aliases = $this->alias->get();
  44. if(!is_array($orig_aliases)) {
  45. $orig_aliases = array();
  46. }
  47. $orig_aliases[] = 'roger@robbit.com';
  48. $this->assertTrue($this->alias->update($orig_aliases, 'forward_and_store'));
  49. $this->assertEqual($this->alias->get(), $orig_aliases);
  50. $this->assertTrue($this->alias->update(array($this->username), 'forward_and_store'));
  51. $this->assertEqual($this->alias->get(), array());
  52. }
  53. }
  54. /* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */