RemoteAliasTest.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. public function testGet() {
  14. /* although we created an alias record, for users, this isn't returned... */
  15. $this->assertEquals($this->alias->get(), array());
  16. }
  17. public function testHasStoreAndForward() {
  18. $this->assertTrue($this->alias->hasStoreAndForward());
  19. }
  20. public function testUpdateRemoteOnly() {
  21. $this->assertTrue($this->alias->update(array('roger@rabbit.com'), 'remote_only'));
  22. $this->assertFalse($this->alias->hasStoreAndForward());
  23. $this->assertTrue($this->alias->update(array('roger@rabbit.com'), 'remote_only'));
  24. $this->assertTrue($this->alias->update(array('roger@rabbit.com', 'fish@fish.net', 'road@runner.com'), 'remote_only'));
  25. $this->assertEquals($this->alias->get(), array('roger@rabbit.com', 'fish@fish.net', 'road@runner.com'));
  26. $this->assertFalse($this->alias->hasStoreAndForward());
  27. }
  28. public function testUpdateForwardandStore() {
  29. $orig_aliases = $this->alias->get();
  30. if (!is_array($orig_aliases)) {
  31. $orig_aliases = array();
  32. }
  33. $orig_aliases[] = 'roger@robbit.com';
  34. $this->assertTrue($this->alias->update($orig_aliases, 'forward_and_store'));
  35. $this->assertEquals($this->alias->get(), $orig_aliases);
  36. $this->assertTrue($this->alias->update(array($this->username), 'forward_and_store'));
  37. $this->assertEquals($this->alias->get(), array());
  38. }
  39. }
  40. /* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */