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