EmailListRecipientQueryTest.php 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Gdata
  17. * @subpackage UnitTests
  18. * @copyright Copyright (c) 2006 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. */
  21. require_once 'Zend/Gdata/Gapps.php';
  22. require_once 'Zend/Gdata/Gapps/EmailListRecipientQuery.php';
  23. /**
  24. * @package Zend_Gdata
  25. * @subpackage UnitTests
  26. */
  27. class Zend_Gdata_Gapps_EmailListRecipientQueryTest extends PHPUnit_Framework_TestCase
  28. {
  29. public function setUp()
  30. {
  31. $this->query = new Zend_Gdata_Gapps_EmailListRecipientQuery();
  32. }
  33. // Test to make sure that the domain accessor methods work and propagate
  34. // to the query URI.
  35. public function testCanSetQueryDomain()
  36. {
  37. $this->query->setEmailListName("something");
  38. $this->query->setDomain("my.domain.com");
  39. $this->assertEquals("my.domain.com", $this->query->getDomain());
  40. $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/emailList/2.0/something/recipient/",
  41. $this->query->getQueryUrl());
  42. $this->query->setDomain("hello.world.baz");
  43. $this->assertEquals("hello.world.baz", $this->query->getDomain());
  44. $this->assertEquals("https://apps-apis.google.com/a/feeds/hello.world.baz/emailList/2.0/something/recipient/",
  45. $this->query->getQueryUrl());
  46. }
  47. // Test to make sure that the emailListName accessor methods work and propagate
  48. // to the query URI.
  49. public function testCanSetEmailListNameProperty()
  50. {
  51. $this->query->setDomain("my.domain.com");
  52. $this->query->setEmailListName("foo");
  53. $this->assertEquals("foo", $this->query->getEmailListName());
  54. $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/emailList/2.0/foo/recipient/",
  55. $this->query->getQueryUrl());
  56. $this->query->setEmailListName("bar");
  57. $this->assertEquals("bar", $this->query->getEmailListName());
  58. $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/emailList/2.0/bar/recipient/",
  59. $this->query->getQueryUrl());
  60. }
  61. public function testCanSetStartRecipientProperty()
  62. {
  63. $this->query->setDomain("my.domain.com");
  64. $this->query->setEmailListName("foo");
  65. $this->query->setStartRecipient("bar");
  66. $this->assertEquals("bar", $this->query->getStartRecipient());
  67. $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/emailList/2.0/foo/recipient/?startRecipient=bar",
  68. $this->query->getQueryUrl());
  69. $this->query->setStartRecipient(null);
  70. $this->assertEquals(null, $this->query->getStartRecipient());
  71. $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/emailList/2.0/foo/recipient/",
  72. $this->query->getQueryUrl());
  73. }
  74. }