SnippetQueryTest.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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_Gbase
  17. * @subpackage UnitTests
  18. * @copyright Copyright (c) 2005-2012 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/Gbase.php';
  23. require_once 'Zend/Gdata/Gbase/SnippetQuery.php';
  24. require_once 'Zend/Http/Client.php';
  25. /**
  26. * @category Zend
  27. * @package Zend_Gdata_Gbase
  28. * @subpackage UnitTests
  29. * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  30. * @license http://framework.zend.com/license/new-bsd New BSD License
  31. * @group Zend_Gdata
  32. * @group Zend_Gdata_Gbase
  33. */
  34. class Zend_Gdata_Gbase_SnippetQueryTest extends PHPUnit_Framework_TestCase
  35. {
  36. public function setUp()
  37. {
  38. $this->snippetQuery = new Zend_Gdata_Gbase_SnippetQuery();
  39. }
  40. public function testBq()
  41. {
  42. $this->snippetQuery->resetParameters();
  43. $this->snippetQuery->setBq('[title:PHP]');
  44. $this->assertEquals($this->snippetQuery->getBq(), '[title:PHP]');
  45. }
  46. public function testRefine()
  47. {
  48. $this->snippetQuery->resetParameters();
  49. $this->snippetQuery->setRefine('true');
  50. $this->assertEquals($this->snippetQuery->getRefine(), 'true');
  51. }
  52. public function testContent()
  53. {
  54. $this->snippetQuery->resetParameters();
  55. $this->snippetQuery->setContent('stats');
  56. $this->assertEquals($this->snippetQuery->getContent(), 'stats');
  57. }
  58. public function testOrderBy()
  59. {
  60. $this->snippetQuery->resetParameters();
  61. $this->snippetQuery->setOrderBy('relevancy');
  62. $this->assertEquals($this->snippetQuery->getOrderBy(), 'relevancy');
  63. }
  64. public function testSortOrder()
  65. {
  66. $this->snippetQuery->resetParameters();
  67. $this->snippetQuery->setOrderBy('descending');
  68. $this->assertEquals($this->snippetQuery->getOrderBy(), 'descending');
  69. }
  70. public function testCrowdBy()
  71. {
  72. $this->snippetQuery->resetParameters();
  73. $this->snippetQuery->setCrowdBy('attribute:5,content:2,url');
  74. $this->assertEquals($this->snippetQuery->getCrowdBy(), 'attribute:5,content:2,url');
  75. }
  76. public function testAdjust()
  77. {
  78. $this->snippetQuery->resetParameters();
  79. $this->snippetQuery->setAdjust('true');
  80. $this->assertEquals($this->snippetQuery->getAdjust(), 'true');
  81. }
  82. }