Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add service & add tests

Add service & add tests
  • Loading branch information...
commit 09ce5867f4fa3c4a88c4c344eab414ec740a73ab 1 parent 9b1378c
Blanchon Vincent blanchonvincent authored
35 library/Zend/Mvc/Service/PaginatorPluginManagerFactory.php
View
@@ -0,0 +1,35 @@
+<?php
+/**
+ * Zend Framework (http://framework.zend.com/)
+ *
+ * @link http://github.com/zendframework/zf2 for the canonical source repository
+ * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license http://framework.zend.com/license/new-bsd New BSD License
+ * @package Zend_Mvc
+ */
+
+namespace Zend\Mvc\Service;
+
+use Zend\ServiceManager\ServiceLocatorInterface;
+
+/**
+ * @category Zend
+ * @package Zend_Mvc
+ * @subpackage Service
+ */
+class PaginatorPluginManagerFactory extends AbstractPluginManagerFactory
+{
+ const PLUGIN_MANAGER_CLASS = 'Zend\Paginator\AdapterPluginManager';
+
+ /**
+ * Create and return the MVC controller plugin manager
+ *
+ * @param ServiceLocatorInterface $serviceLocator
+ * @return ControllerPluginManager
+ */
+ public function createService(ServiceLocatorInterface $serviceLocator)
+ {
+ $plugins = parent::createService($serviceLocator);
+ return $plugins;
+ }
+}
1  library/Zend/Mvc/Service/ServiceListenerFactory.php
View
@@ -53,6 +53,7 @@ class ServiceListenerFactory implements FactoryInterface
'ConsoleRouter' => 'Zend\Mvc\Service\RouterFactory',
'DependencyInjector' => 'Zend\Mvc\Service\DiFactory',
'HttpRouter' => 'Zend\Mvc\Service\RouterFactory',
+ 'PaginatorPluginManager' => 'Zend\Mvc\Service\PaginatorPluginManagerFactory',
'Request' => 'Zend\Mvc\Service\RequestFactory',
'Response' => 'Zend\Mvc\Service\ResponseFactory',
'Router' => 'Zend\Mvc\Service\RouterFactory',
15 tests/ZendTest/Paginator/AdapterPluginManagerTest.php
View
@@ -11,6 +11,8 @@
namespace ZendTest\Paginator;
use Zend\Paginator\AdapterPluginManager;
+use Zend\ServiceManager\ServiceManager;
+use Zend\Mvc\Service\ServiceManagerConfig;
/**
* @category Zend
@@ -59,4 +61,17 @@ public function testCanRetrieveAdapterPlugin()
$this->assertInstanceOf('Zend\Paginator\Adapter\Null', $plugin);
}
+ public function testCanRetrievePluginManagerWithServiceManager()
+ {
+ $sm = $this->serviceManager = new ServiceManager(
+ new ServiceManagerConfig(array(
+ 'factories' => array(
+ 'PaginatorPluginManager' => 'Zend\Mvc\Service\PaginatorPluginManagerFactory',
+ ),
+ ))
+ );
+ $sm->setService('Config', array());
+ $adapterPluginManager = $sm->get('PaginatorPluginManager');
+ $this->assertInstanceOf('Zend\Paginator\AdapterPluginManager', $adapterPluginManager);
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.