Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Commit

Permalink
[#1970] Added imports
Browse files Browse the repository at this point in the history
- Also, many classes that were fully qualified already had imports, or
  were within the same namespace; updated those references.
  • Loading branch information
weierophinney committed Jul 25, 2012
1 parent 4e9361e commit 5847beb
Showing 1 changed file with 24 additions and 21 deletions.
45 changes: 24 additions & 21 deletions tests/Zend/Paginator/PaginatorTest.php
Expand Up @@ -10,11 +10,14 @@

namespace ZendTest\Paginator;

use ReflectionMethod;
use stdClass;
use Zend\Cache\StorageFactory as CacheFactory;
use Zend\Cache\Storage\Adapter\AdapterInterface as CacheAdapter;
use Zend\Config;
use Zend\Db\Adapter as DbAdapter;
use Zend\Db\Sql;
use Zend\Filter;
use Zend\Paginator;
use Zend\Paginator\Adapter;
use Zend\Paginator\Exception;
Expand All @@ -34,7 +37,7 @@ class PaginatorTest extends \PHPUnit_Framework_TestCase
/**
* Paginator instance
*
* @var \Zend\Paginator\Paginator
* @var Paginator\Paginator
*/
protected $_paginator = null;

Expand All @@ -47,7 +50,7 @@ class PaginatorTest extends \PHPUnit_Framework_TestCase
protected $_config = null;

/**
* @var \Zend\Db\Adapter\Adapter
* @var DbAdapter\Adapter
*/
protected $_adapter = null;

Expand Down Expand Up @@ -169,7 +172,7 @@ public function testFactoryReturnsNullAdapter()
public function testFactoryThrowsInvalidClassExceptionAdapter()
{
$this->setExpectedException('Zend\Paginator\Exception\InvalidArgumentException', 'No adapter for type stdClass');
$paginator = Paginator\Paginator::factory(new \stdClass());
$paginator = Paginator\Paginator::factory(new stdClass());
}

public function testFactoryThrowsInvalidTypeExceptionAdapter()
Expand Down Expand Up @@ -216,7 +219,7 @@ public function testLoadsFromConfig()

public function testGetsPagesForPageOne()
{
$expected = new \stdClass();
$expected = new stdClass();
$expected->pageCount = 11;
$expected->itemCountPerPage = 10;
$expected->first = 1;
Expand All @@ -238,7 +241,7 @@ public function testGetsPagesForPageOne()

public function testGetsPagesForPageTwo()
{
$expected = new \stdClass();
$expected = new stdClass();
$expected->pageCount = 11;
$expected->itemCountPerPage = 10;
$expected->first = 1;
Expand Down Expand Up @@ -574,7 +577,7 @@ public function testCastsIntegerValuesToInteger()
*/
public function testAcceptsTraversableInstanceFromAdapter()
{
$paginator = new Paginator\Paginator(new \ZendTest\Paginator\TestAsset\TestAdapter());
$paginator = new Paginator\Paginator(new TestAsset\TestAdapter());
$this->assertInstanceOf('ArrayObject', $paginator->getCurrentItems());
}

Expand Down Expand Up @@ -672,7 +675,7 @@ public function testToJson()
// ZF-5519
public function testFilter()
{
$filter = new \Zend\Filter\Callback(array($this, 'filterCallback'));
$filter = new Filter\Callback(array($this, 'filterCallback'));
$paginator = Paginator\Paginator::factory(range(1, 10));
$paginator->setFilter($filter);

Expand Down Expand Up @@ -801,7 +804,7 @@ public function testSetAdapterPluginManagerWithAdapterThrowsInvalidArgumentExcep
);

$this->_paginator->setAdapterPluginManager(
new \stdClass()
new stdClass()
);
}

Expand All @@ -814,7 +817,7 @@ public function testSetAdapterPluginManagerWithAdaptersThrowsInvalidArgumentExce

$this->_paginator->setAdapterPluginManager(
array(
new \stdClass()
new stdClass()
)
);
}
Expand Down Expand Up @@ -847,15 +850,15 @@ public function testSetScrollingStylePluginManagerWithAdapterThrowsInvalidArgume
);

$this->_paginator->setScrollingStylePluginManager(
new \stdClass()
new stdClass()
);
}

public function testLoadScrollingStyleWithDigitThrowsInvalidArgumentException()
{
$adapter = new \ZendTest\Paginator\TestAsset\TestAdapter;
$paginator = new \Zend\Paginator\Paginator($adapter);
$reflection = new \ReflectionMethod($paginator, '_loadScrollingStyle');
$adapter = new TestAsset\TestAdapter;
$paginator = new Paginator\Paginator($adapter);
$reflection = new ReflectionMethod($paginator, '_loadScrollingStyle');
$reflection->setAccessible(true);

$this->setExpectedException(
Expand All @@ -869,28 +872,28 @@ public function testLoadScrollingStyleWithDigitThrowsInvalidArgumentException()

public function testLoadScrollingStyleWithObjectThrowsInvalidArgumentException()
{
$adapter = new \ZendTest\Paginator\TestAsset\TestAdapter;
$paginator = new \Zend\Paginator\Paginator($adapter);
$reflection = new \ReflectionMethod($paginator, '_loadScrollingStyle');
$adapter = new TestAsset\TestAdapter;
$paginator = new Paginator\Paginator($adapter);
$reflection = new ReflectionMethod($paginator, '_loadScrollingStyle');
$reflection->setAccessible(true);

$this->setExpectedException(
'Zend\Paginator\Exception\InvalidArgumentException',
'Scrolling style must implement Zend\Paginator\ScrollingStyle\ScrollingStyleInterface'
);

$reflection->invoke($paginator, new \stdClass());
$reflection->invoke($paginator, new stdClass());
}

public function testGetCacheId()
{
$adapter = new \ZendTest\Paginator\TestAsset\TestAdapter;
$paginator = new \Zend\Paginator\Paginator($adapter);
$reflectionGetCacheId = new \ReflectionMethod($paginator, '_getCacheId');
$adapter = new TestAsset\TestAdapter;
$paginator = new Paginator\Paginator($adapter);
$reflectionGetCacheId = new ReflectionMethod($paginator, '_getCacheId');
$reflectionGetCacheId->setAccessible(true);
$outputGetCacheId = $reflectionGetCacheId->invoke($paginator, null);

$reflectionGetCacheInternalId = new \ReflectionMethod($paginator, '_getCacheInternalId');
$reflectionGetCacheInternalId = new ReflectionMethod($paginator, '_getCacheInternalId');
$reflectionGetCacheInternalId->setAccessible(true);
$outputGetCacheInternalId = $reflectionGetCacheInternalId->invoke($paginator);

Expand Down

1 comment on commit 5847beb

@eddiejaoude
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you - I will make sure I get it right next time.

Please sign in to comment.