CellQueryTest.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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_CellQueryTest extends PHPUnit_Framework_TestCase
  28. {
  29. public function setUp()
  30. {
  31. $this->docQuery = new Zend_Gdata_Spreadsheets_CellQuery();
  32. }
  33. public function testMinRow()
  34. {
  35. $this->assertTrue($this->docQuery->getMinRow() == null);
  36. $this->docQuery->setMinRow('1');
  37. $this->assertTrue($this->docQuery->getMinRow() == '1');
  38. $this->assertTrue($this->docQuery->getQueryString() == '?min-row=1');
  39. $this->docQuery->setMinRow(null);
  40. $this->assertTrue($this->docQuery->getMinRow() == null);
  41. }
  42. public function testMaxRow()
  43. {
  44. $this->assertTrue($this->docQuery->getMaxRow() == null);
  45. $this->docQuery->setMaxRow('2');
  46. $this->assertTrue($this->docQuery->getMaxRow() == '2');
  47. $this->assertTrue($this->docQuery->getQueryString() == '?max-row=2');
  48. $this->docQuery->setMaxRow(null);
  49. $this->assertTrue($this->docQuery->getMaxRow() == null);
  50. }
  51. public function testMinCol()
  52. {
  53. $this->assertTrue($this->docQuery->getMinCol() == null);
  54. $this->docQuery->setMinCol('3');
  55. $this->assertTrue($this->docQuery->getMinCol() == '3');
  56. $this->assertTrue($this->docQuery->getQueryString() == '?min-col=3');
  57. $this->docQuery->setMinCol(null);
  58. $this->assertTrue($this->docQuery->getMinCol() == null);
  59. }
  60. public function testMaxCol()
  61. {
  62. $this->assertTrue($this->docQuery->getMaxCol() == null);
  63. $this->docQuery->setMaxCol('4');
  64. $this->assertTrue($this->docQuery->getMaxCol() == '4');
  65. $this->assertTrue($this->docQuery->getQueryString() == '?max-col=4');
  66. $this->docQuery->setMaxCol(null);
  67. $this->assertTrue($this->docQuery->getMaxCol() == null);
  68. }
  69. public function testRange()
  70. {
  71. $this->assertTrue($this->docQuery->getRange() == null);
  72. $this->docQuery->setRange('A1:B4');
  73. $this->assertTrue($this->docQuery->getRange() == 'A1:B4');
  74. $this->assertTrue($this->docQuery->getQueryString() == '?range=A1%3AB4');
  75. $this->docQuery->setRange(null);
  76. $this->assertTrue($this->docQuery->getRange() == null);
  77. }
  78. public function testReturnEmpty()
  79. {
  80. $this->assertTrue($this->docQuery->getReturnEmpty() == null);
  81. $this->docQuery->setReturnEmpty('false');
  82. $this->assertTrue($this->docQuery->getReturnEmpty() == 'false');
  83. $this->assertTrue($this->docQuery->getQueryString() == '?return-empty=false');
  84. $this->docQuery->setReturnEmpty(null);
  85. $this->assertTrue($this->docQuery->getReturnEmpty() == null);
  86. }
  87. public function testWorksheetId()
  88. {
  89. $this->assertTrue($this->docQuery->getWorksheetId() == 'default');
  90. $this->docQuery->setWorksheetId('123');
  91. $this->assertTrue($this->docQuery->getWorksheetId() == '123');
  92. }
  93. public function testSpreadsheetKey()
  94. {
  95. $this->assertTrue($this->docQuery->getSpreadsheetKey() == null);
  96. $this->docQuery->setSpreadsheetKey('abc');
  97. $this->assertTrue($this->docQuery->getSpreadsheetKey() == 'abc');
  98. }
  99. public function testCellId()
  100. {
  101. $this->assertTrue($this->docQuery->getCellId() == null);
  102. $this->docQuery->setCellId('xyz');
  103. $this->assertTrue($this->docQuery->getCellId() == 'xyz');
  104. }
  105. public function testProjection()
  106. {
  107. $this->assertTrue($this->docQuery->getProjection() == 'full');
  108. $this->docQuery->setProjection('abc');
  109. $this->assertTrue($this->docQuery->getProjection() == 'abc');
  110. }
  111. public function testVisibility()
  112. {
  113. $this->assertTrue($this->docQuery->getVisibility() == 'private');
  114. $this->docQuery->setVisibility('xyz');
  115. $this->assertTrue($this->docQuery->getVisibility() == 'xyz');
  116. }
  117. }