<commit_before><?php

/**
 * Zend Framework
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://framework.zend.com/license/new-bsd
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to <EMAIL> so we can send you a copy immediately.
 *
 * @category   Zend
 * @package    Zend_Service_Amazon_SimpleDb
 * @subpackage UnitTests
 * @copyright  Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 * @version    $Id: OfflineTest.php 8064 2008-02-16 10:58:39Z thomas $
 */

require_once 'Zend/Service/Amazon/SimpleDb/Page.php';

/**
 * @category   Zend
 * @package    Zend_Service_Amazon_SimpleDb
 * @subpackage UnitTests
 * @copyright  Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 */
class Zend_Service_Amazon_SimpleDb_PageTest extends PHPUnit_Framework_TestCase
{
    /**
     * @var Zend_Service_Amazon_SimpleDb_Page
     */
    protected $page;

    public function setUp()
    {
        $this->page = new Zend_Service_Amazon_SimpleDb_Page('foobar');
    }

    public function testSetAndGetDataPerMethods()
    {
        $this->page->setData('data');
        $this->assertEquals('data', $this->page->getData());
    }

    public function testSetDataPerConstructor()
    {
        $page = new Zend_Service_Amazon_SimpleDb_Page('data');
        $this->assertEquals('data', $page->getData());
    }

    public function testSetAndGetTokenPerMethods()
    {
        $this->page->setToken('token');
        $this->assertEquals('token', $this->page->getToken());
    }

    public function testSetTokenPerConstructor()
    {
        $page = new Zend_Service_Amazon_SimpleDb_Page('data', 'token');
        $this->assertEquals('token', $page->getToken());
    }

    public function testSetTokenShouldAcceptsNullValue()
    {
        $this->page->setToken('token');
        $this->page->setToken(null);
        $this->assertNull($this->page->getToken());
    }

    public function testSetTokenDoesNotAcceptsEmptyStrings()
    {
        $this->page->setToken('token');
        $this->page->setToken('');
        $this->assertNull($this->page->getToken());
    }

    public function testToStringMethod()
    {
        $this->page->setData('data');
        $this->page->setToken('token');
        $this->assertEquals(
            "Page with token: token\n and data: data",
            $this->page->__toString()
        );
    }
}<commit_msg>Adds unit tests for isLast method in Zend_Service_Amazon_SimpleDb_Page<commit_after><?php

/**
 * Zend Framework
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://framework.zend.com/license/new-bsd
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to <EMAIL> so we can send you a copy immediately.
 *
 * @category   Zend
 * @package    Zend_Service_Amazon_SimpleDb
 * @subpackage UnitTests
 * @copyright  Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 * @version    $Id: OfflineTest.php 8064 2008-02-16 10:58:39Z thomas $
 */

require_once 'Zend/Service/Amazon/SimpleDb/Page.php';

/**
 * @category   Zend
 * @package    Zend_Service_Amazon_SimpleDb
 * @subpackage UnitTests
 * @copyright  Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 */
class Zend_Service_Amazon_SimpleDb_PageTest extends PHPUnit_Framework_TestCase
{
    /**
     * @var Zend_Service_Amazon_SimpleDb_Page
     */
    protected $page;

    public function setUp()
    {
        $this->page = new Zend_Service_Amazon_SimpleDb_Page('foobar');
    }

    public function testSetAndGetDataPerMethods()
    {
        $this->page->setData('data');
        $this->assertEquals('data', $this->page->getData());
    }

    public function testSetDataPerConstructor()
    {
        $page = new Zend_Service_Amazon_SimpleDb_Page('data');
        $this->assertEquals('data', $page->getData());
    }

    public function testSetAndGetTokenPerMethods()
    {
        $this->page->setToken('token');
        $this->assertEquals('token', $this->page->getToken());
    }

    public function testSetTokenPerConstructor()
    {
        $page = new Zend_Service_Amazon_SimpleDb_Page('data', 'token');
        $this->assertEquals('token', $page->getToken());
    }

    public function testSetTokenShouldAcceptsNullValue()
    {
        $this->page->setToken('token');
        $this->page->setToken(null);
        $this->assertNull($this->page->getToken());
    }

    public function testSetTokenDoesNotAcceptsEmptyStrings()
    {
        $this->page->setToken('token');
        $this->page->setToken('');
        $this->assertNull($this->page->getToken());
    }

    public function testIsLastShouldReturnTrueWhenNoTokenIsSet()
    {
        $this->assertTrue($this->page->isLast());
    }

    public function testIsLastShouldReturnFalseWhenTokenIsSet()
    {
        $this->page->setToken('token');
        $this->assertFalse($this->page->isLast());
    }

    public function testIsLastShouldReturnTrueWhenTokenIsRemoved()
    {
        $this->page->setToken('');
        $this->assertTrue($this->page->isLast());
    }

    public function testToStringMethod()
    {
        $this->page->setData('data');
        $this->page->setToken('token');
        $this->assertEquals(
            "Page with token: token\n and data: data",
            $this->page->__toString()
        );
    }
}
{'fraction_non_alphanumeric': 0.1351931330472103, 'fraction_numerical': 0.011224826675470452, 'mean_word_length': 3.0719086021505375, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 90, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6030783', 'n_tokens_mistral': 1903, 'n_tokens_neox': 1786, 'n_words': 393}