Permalink
Browse files

Add test with AdapterAggregateInterface

Add test with AdapterAggregateInterface
  • Loading branch information...
1 parent 76f8c64 commit b278ea423aaa381e5241b53b7b0ce232bffcc71c @blanchonvincent blanchonvincent committed Sep 8, 2012
Showing with 18 additions and 4 deletions.
  1. +18 −4 tests/ZendTest/Paginator/FactoryTest.php
@@ -10,8 +10,8 @@
namespace ZendTest\Paginator;
-use Zend\Paginator\Factory;
-use Zend\Paginator\Adapter\ArrayAdapter;
+use Zend\Paginator;
+use Zend\Paginator\Adapter;
/**
* @category Zend
@@ -24,16 +24,30 @@ class FactoryTest extends \PHPUnit_Framework_TestCase
public function testCanFactoryPaginatorWithStringAdapterObject()
{
$datas = array(1, 2, 3);
- $paginator = Factory::Factory($datas, new ArrayAdapter($datas));
+ $paginator = Paginator\Factory::Factory($datas, new Adapter\ArrayAdapter($datas));
$this->assertInstanceOf('Zend\Paginator\Adapter\ArrayAdapter', $paginator->getAdapter());
$this->assertEquals(count($datas), $paginator->getCurrentItemCount());
}
public function testCanFactoryPaginatorWithStringAdapterName()
{
$datas = array(1, 2, 3);
- $paginator = Factory::Factory($datas, 'array');
+ $paginator = Paginator\Factory::Factory($datas, 'array');
$this->assertInstanceOf('Zend\Paginator\Adapter\ArrayAdapter', $paginator->getAdapter());
$this->assertEquals(count($datas), $paginator->getCurrentItemCount());
}
+
+ public function testCanFactoryPaginatorWithStringAdapterAggregate()
+ {
+ $paginator = Paginator\Factory::Factory(null, new TestArrayAggregate);
+ $this->assertInstanceOf('Zend\Paginator\Adapter\ArrayAdapter', $paginator->getAdapter());
+ }
+}
+
+class TestArrayAggregate implements Paginator\AdapterAggregateInterface
+{
+ public function getPaginatorAdapter()
+ {
+ return new Adapter\ArrayAdapter(array(1, 2, 3, 4));
+ }
}

0 comments on commit b278ea4

Please sign in to comment.