Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Commit 68a6610

Browse files
committed
Adds unit tests for Zend_Service_Amazon_SimpleDb_Page
1 parent 4134b1b commit 68a6610

File tree

2 files changed

+99
-0
lines changed

2 files changed

+99
-0
lines changed

tests/Zend/Service/Amazon/SimpleDb/AllTests.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@
3434
*/
3535
require_once 'Zend/Service/Amazon/SimpleDb/OnlineTest.php';
3636

37+
/**
38+
* @see Zend_Service_Amazon_SimpleDb_PageTest
39+
*/
40+
require_once 'Zend/Service/Amazon/SimpleDb/PageTest.php';
41+
3742
/**
3843
* @category Zend
3944
* @package Zend_Service_Amazon_SimpleDb
@@ -72,6 +77,8 @@ public static function suite()
7277
$suite->addTestSuite('Zend_Service_Amazon_SimpleDb_OfflineTest');
7378
}
7479

80+
$suite->addTestSuite('Zend_Service_Amazon_SimpleDb_PageTest');
81+
7582
return $suite;
7683
}
7784
}
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
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

Comments
 (0)