OwnerQueryTest.php 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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/OwnerQuery.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_OwnerQueryTest extends PHPUnit_Framework_TestCase
  34. {
  35. public function setUp()
  36. {
  37. $this->query = new Zend_Gdata_Gapps_OwnerQuery();
  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/owner",
  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/owner",
  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/owner",
  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/owner",
  65. $this->query->getQueryUrl());
  66. }
  67. public function testCanSetOwnerEmailProperty()
  68. {
  69. $this->query->setDomain("my.domain.com");
  70. $this->query->setGroupId("foo");
  71. $this->query->setOwnerEmail("bar@blah.com");
  72. $this->assertEquals("bar@blah.com", $this->query->getOwnerEmail());
  73. $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/foo/owner/bar@blah.com",
  74. $this->query->getQueryUrl());
  75. $this->query->setOwnerEmail('baz@blah.com');
  76. $this->assertEquals('baz@blah.com', $this->query->getOwnerEmail());
  77. $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/foo/owner/baz@blah.com",
  78. $this->query->getQueryUrl());
  79. }
  80. }