EmailListRecipientQueryTest.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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_Gapps
  17. * @subpackage UnitTests
  18. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id $
  21. */
  22. require_once 'Zend/Gdata/Gapps.php';
  23. require_once 'Zend/Gdata/Gapps/EmailListRecipientQuery.php';
  24. /**
  25. * @category Zend
  26. * @package Zend_Gdata_Gapps
  27. * @subpackage UnitTests
  28. * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
  29. * @license http://framework.zend.com/license/new-bsd New BSD License
  30. * @group Zend_Gdata
  31. * @group Zend_Gdata_Gapps
  32. */
  33. class Zend_Gdata_Gapps_EmailListRecipientQueryTest extends PHPUnit_Framework_TestCase
  34. {
  35. public function setUp()
  36. {
  37. $this->query = new Zend_Gdata_Gapps_EmailListRecipientQuery();
  38. }
  39. // Test to make sure that the domain accessor methods work and propagate
  40. // to the query URI.
  41. public function testCanSetQueryDomain()
  42. {
  43. $this->query->setEmailListName("something");
  44. $this->query->setDomain("my.domain.com");
  45. $this->assertEquals("my.domain.com", $this->query->getDomain());
  46. $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/emailList/2.0/something/recipient/",
  47. $this->query->getQueryUrl());
  48. $this->query->setDomain("hello.world.baz");
  49. $this->assertEquals("hello.world.baz", $this->query->getDomain());
  50. $this->assertEquals("https://apps-apis.google.com/a/feeds/hello.world.baz/emailList/2.0/something/recipient/",
  51. $this->query->getQueryUrl());
  52. }
  53. // Test to make sure that the emailListName accessor methods work and propagate
  54. // to the query URI.
  55. public function testCanSetEmailListNameProperty()
  56. {
  57. $this->query->setDomain("my.domain.com");
  58. $this->query->setEmailListName("foo");
  59. $this->assertEquals("foo", $this->query->getEmailListName());
  60. $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/emailList/2.0/foo/recipient/",
  61. $this->query->getQueryUrl());
  62. $this->query->setEmailListName("bar");
  63. $this->assertEquals("bar", $this->query->getEmailListName());
  64. $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/emailList/2.0/bar/recipient/",
  65. $this->query->getQueryUrl());
  66. }
  67. public function testCanSetStartRecipientProperty()
  68. {
  69. $this->query->setDomain("my.domain.com");
  70. $this->query->setEmailListName("foo");
  71. $this->query->setStartRecipient("bar");
  72. $this->assertEquals("bar", $this->query->getStartRecipient());
  73. $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/emailList/2.0/foo/recipient/?startRecipient=bar",
  74. $this->query->getQueryUrl());
  75. $this->query->setStartRecipient(null);
  76. $this->assertEquals(null, $this->query->getStartRecipient());
  77. $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/emailList/2.0/foo/recipient/",
  78. $this->query->getQueryUrl());
  79. }
  80. }