PageTest.php 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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_Service_Amazon_SimpleDb
  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: OfflineTest.php 8064 2008-02-16 10:58:39Z thomas $
  21. */
  22. require_once 'Zend/Service/Amazon/SimpleDb/Page.php';
  23. /**
  24. * @category Zend
  25. * @package Zend_Service_Amazon_SimpleDb
  26. * @subpackage UnitTests
  27. * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
  28. * @license http://framework.zend.com/license/new-bsd New BSD License
  29. */
  30. class Zend_Service_Amazon_SimpleDb_PageTest extends PHPUnit_Framework_TestCase
  31. {
  32. /**
  33. * @var Zend_Service_Amazon_SimpleDb_Page
  34. */
  35. protected $page;
  36. public function setUp()
  37. {
  38. $this->page = new Zend_Service_Amazon_SimpleDb_Page('foobar');
  39. }
  40. public function testSetAndGetDataPerMethods()
  41. {
  42. $this->page->setData('data');
  43. $this->assertEquals('data', $this->page->getData());
  44. }
  45. public function testSetDataPerConstructor()
  46. {
  47. $page = new Zend_Service_Amazon_SimpleDb_Page('data');
  48. $this->assertEquals('data', $page->getData());
  49. }
  50. public function testSetAndGetTokenPerMethods()
  51. {
  52. $this->page->setToken('token');
  53. $this->assertEquals('token', $this->page->getToken());
  54. }
  55. public function testSetTokenPerConstructor()
  56. {
  57. $page = new Zend_Service_Amazon_SimpleDb_Page('data', 'token');
  58. $this->assertEquals('token', $page->getToken());
  59. }
  60. public function testSetTokenShouldAcceptsNullValue()
  61. {
  62. $this->page->setToken('token');
  63. $this->page->setToken(null);
  64. $this->assertNull($this->page->getToken());
  65. }
  66. public function testSetTokenDoesNotAcceptsEmptyStrings()
  67. {
  68. $this->page->setToken('token');
  69. $this->page->setToken('');
  70. $this->assertNull($this->page->getToken());
  71. }
  72. public function testToStringMethod()
  73. {
  74. $this->page->setData('data');
  75. $this->page->setToken('token');
  76. $this->assertEquals(
  77. "Page with token: token\n and data: data",
  78. $this->page->__toString()
  79. );
  80. }
  81. }