SnippetQueryTest.php 2.7 KB

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