MemberQueryTest.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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/MemberQuery.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_MemberQueryTest extends PHPUnit_Framework_TestCase
  34. {
  35. public function setUp()
  36. {
  37. $this->query = new Zend_Gdata_Gapps_MemberQuery();
  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->setGroupId("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/group/2.0/my.domain.com/something/member",
  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/group/2.0/hello.world.baz/something/member",
  51. $this->query->getQueryUrl());
  52. }
  53. // Test to make sure that the groupId accessor methods work and propagate
  54. // to the query URI.
  55. public function testCanSetGroupIdProperty()
  56. {
  57. $this->query->setDomain("my.domain.com");
  58. $this->query->setGroupId("foo");
  59. $this->assertEquals("foo", $this->query->getGroupId());
  60. $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/foo/member",
  61. $this->query->getQueryUrl());
  62. $this->query->setGroupId("bar");
  63. $this->assertEquals("bar", $this->query->getGroupId());
  64. $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/bar/member",
  65. $this->query->getQueryUrl());
  66. }
  67. // Test to make sure that the memberId accessor methods work and propagate
  68. // to the query URI.
  69. public function testCanSetMemberIdProperty()
  70. {
  71. $this->query->setDomain("my.domain.com");
  72. $this->query->setGroupId("foo");
  73. $this->query->setMemberId("bar");
  74. $this->assertEquals("bar", $this->query->getMemberId());
  75. $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/foo/member/bar",
  76. $this->query->getQueryUrl());
  77. $this->query->setGroupId("baz");
  78. $this->query->setMemberId(null);
  79. $this->assertEquals(null, $this->query->getMemberId());
  80. $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/baz/member",
  81. $this->query->getQueryUrl());
  82. }
  83. public function testCanSetStartMemberIdProperty()
  84. {
  85. $this->query->setDomain("my.domain.com");
  86. $this->query->setGroupId("foo");
  87. $this->query->setStartMemberId("bar");
  88. $this->assertEquals("bar", $this->query->getStartMemberId());
  89. $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/foo/member?start=bar",
  90. $this->query->getQueryUrl());
  91. $this->query->setStartMemberId(null);
  92. $this->assertEquals(null, $this->query->getStartMemberId());
  93. $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/foo/member",
  94. $this->query->getQueryUrl());
  95. }
  96. }