1
+ <?php
2
+
3
+ /**
4
+ * Zend Framework
5
+ *
6
+ * LICENSE
7
+ *
8
+ * This source file is subject to the new BSD license that is bundled
9
+ * with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://framework.zend.com/license/new-bsd
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to [email protected] so we can send you a copy immediately.
15
+ *
16
+ * @category Zend
17
+ * @package Zend_Service_Amazon_SimpleDb
18
+ * @subpackage UnitTests
19
+ * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
20
+ * @license http://framework.zend.com/license/new-bsd New BSD License
21
+ * @version $Id: OfflineTest.php 8064 2008-02-16 10:58:39Z thomas $
22
+ */
23
+
24
+ require_once 'Zend/Service/Amazon/SimpleDb/Page.php ' ;
25
+
26
+ /**
27
+ * @category Zend
28
+ * @package Zend_Service_Amazon_SimpleDb
29
+ * @subpackage UnitTests
30
+ * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
31
+ * @license http://framework.zend.com/license/new-bsd New BSD License
32
+ */
33
+ class Zend_Service_Amazon_SimpleDb_PageTest extends PHPUnit_Framework_TestCase
34
+ {
35
+ /**
36
+ * @var Zend_Service_Amazon_SimpleDb_Page
37
+ */
38
+ protected $ page ;
39
+
40
+ public function setUp ()
41
+ {
42
+ $ this ->page = new Zend_Service_Amazon_SimpleDb_Page ('foobar ' );
43
+ }
44
+
45
+ public function testSetAndGetDataPerMethods ()
46
+ {
47
+ $ this ->page ->setData ('data ' );
48
+ $ this ->assertEquals ('data ' , $ this ->page ->getData ());
49
+ }
50
+
51
+ public function testSetDataPerConstructor ()
52
+ {
53
+ $ page = new Zend_Service_Amazon_SimpleDb_Page ('data ' );
54
+ $ this ->assertEquals ('data ' , $ page ->getData ());
55
+ }
56
+
57
+ public function testSetAndGetTokenPerMethods ()
58
+ {
59
+ $ this ->page ->setToken ('token ' );
60
+ $ this ->assertEquals ('token ' , $ this ->page ->getToken ());
61
+ }
62
+
63
+ public function testSetTokenPerConstructor ()
64
+ {
65
+ $ page = new Zend_Service_Amazon_SimpleDb_Page ('data ' , 'token ' );
66
+ $ this ->assertEquals ('token ' , $ page ->getToken ());
67
+ }
68
+
69
+ public function testSetTokenShouldAcceptsNullValue ()
70
+ {
71
+ $ this ->page ->setToken ('token ' );
72
+ $ this ->page ->setToken (null );
73
+ $ this ->assertNull ($ this ->page ->getToken ());
74
+ }
75
+
76
+ public function testSetTokenDoesNotAcceptsEmptyStrings ()
77
+ {
78
+ $ this ->page ->setToken ('token ' );
79
+ $ this ->page ->setToken ('' );
80
+ $ this ->assertNull ($ this ->page ->getToken ());
81
+ }
82
+
83
+ public function testToStringMethod ()
84
+ {
85
+ $ this ->page ->setData ('data ' );
86
+ $ this ->page ->setToken ('token ' );
87
+ $ this ->assertEquals (
88
+ "Page with token: token \n and data: data " ,
89
+ $ this ->page ->__toString ()
90
+ );
91
+ }
92
+ }
0 commit comments