CellQueryTest.php 4.9 KB

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