ListQueryTest.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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/Spreadsheets.php';
  22. require_once 'Zend/Http/Client.php';
  23. /**
  24. * @package Zend_Gdata
  25. * @subpackage UnitTests
  26. */
  27. class Zend_Gdata_Spreadsheets_ListQueryTest extends PHPUnit_Framework_TestCase
  28. {
  29. public function setUp()
  30. {
  31. $this->docQuery = new Zend_Gdata_Spreadsheets_ListQuery();
  32. }
  33. public function testWorksheetId()
  34. {
  35. $this->assertTrue($this->docQuery->getWorksheetId() == 'default');
  36. $this->docQuery->setWorksheetId('123');
  37. $this->assertTrue($this->docQuery->getWorksheetId() == '123');
  38. }
  39. public function testSpreadsheetKey()
  40. {
  41. $this->assertTrue($this->docQuery->getSpreadsheetKey() == null);
  42. $this->docQuery->setSpreadsheetKey('abc');
  43. $this->assertTrue($this->docQuery->getSpreadsheetKey() == 'abc');
  44. }
  45. public function testRowId()
  46. {
  47. $this->assertTrue($this->docQuery->getRowId() == null);
  48. $this->docQuery->setRowId('xyz');
  49. $this->assertTrue($this->docQuery->getRowId() == 'xyz');
  50. }
  51. public function testProjection()
  52. {
  53. $this->assertTrue($this->docQuery->getProjection() == 'full');
  54. $this->docQuery->setProjection('abc');
  55. $this->assertTrue($this->docQuery->getProjection() == 'abc');
  56. }
  57. public function testVisibility()
  58. {
  59. $this->assertTrue($this->docQuery->getVisibility() == 'private');
  60. $this->docQuery->setVisibility('xyz');
  61. $this->assertTrue($this->docQuery->getVisibility() == 'xyz');
  62. }
  63. public function testSpreadsheetQuery()
  64. {
  65. $this->assertTrue($this->docQuery->getSpreadsheetQuery() == null);
  66. $this->docQuery->setSpreadsheetQuery('first=john&last=smith');
  67. $this->assertTrue($this->docQuery->getSpreadsheetQuery() == 'first=john&last=smith');
  68. $this->assertTrue($this->docQuery->getQueryString() == '?sq=first%3Djohn%26last%3Dsmith');
  69. $this->docQuery->setSpreadsheetQuery(null);
  70. $this->assertTrue($this->docQuery->getSpreadsheetQuery() == null);
  71. }
  72. public function testOrderBy()
  73. {
  74. $this->assertTrue($this->docQuery->getOrderBy() == null);
  75. $this->docQuery->setOrderBy('column:first');
  76. $this->assertTrue($this->docQuery->getOrderBy() == 'column:first');
  77. $this->assertTrue($this->docQuery->getQueryString() == '?orderby=column%3Afirst');
  78. $this->docQuery->setOrderBy(null);
  79. $this->assertTrue($this->docQuery->getOrderBy() == null);
  80. }
  81. public function testReverse()
  82. {
  83. $this->assertTrue($this->docQuery->getReverse() == null);
  84. $this->docQuery->setReverse('true');
  85. $this->assertTrue($this->docQuery->getReverse() == 'true');
  86. $this->assertTrue($this->docQuery->getQueryString() == '?reverse=true');
  87. $this->docQuery->setReverse(null);
  88. $this->assertTrue($this->docQuery->getReverse() == null);
  89. }
  90. }