forked from zendframework/zendframework
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'hotfix/4630' into develop
Forward port zendframework#4630
- Loading branch information
Showing
3 changed files
with
149 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
/** | ||
* Zend Framework (http://framework.zend.com/) | ||
* | ||
* @link http://github.com/zendframework/zf2 for the canonical source repository | ||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
* @package Zend_Mvc | ||
*/ | ||
|
||
namespace ZendTest\Mvc\Service; | ||
|
||
use PHPUnit_Framework_TestCase as TestCase; | ||
use Zend\EventManager\EventManager; | ||
use Zend\Mvc\Router\RoutePluginManager; | ||
use Zend\Mvc\Service\RouterFactory; | ||
use Zend\ServiceManager\ServiceManager; | ||
|
||
class RouterFactoryTest extends TestCase | ||
{ | ||
public function setUp() | ||
{ | ||
$this->services = new ServiceManager(); | ||
$this->services->setService('RoutePluginManager', new RoutePluginManager()); | ||
$this->factory = new RouterFactory(); | ||
} | ||
|
||
public function testFactoryCanCreateRouterBasedOnConfiguredName() | ||
{ | ||
$this->services->setService('Config', array( | ||
'router' => array( | ||
'router_class' => 'ZendTest\Mvc\Service\TestAsset\Router', | ||
), | ||
'console' => array( | ||
'router' => array( | ||
'router_class' => 'ZendTest\Mvc\Service\TestAsset\Router', | ||
), | ||
), | ||
)); | ||
|
||
$router = $this->factory->createService($this->services, 'router', 'Router'); | ||
$this->assertInstanceOf('ZendTest\Mvc\Service\TestAsset\Router', $router); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
<?php | ||
/** | ||
* Zend Framework (http://framework.zend.com/) | ||
* | ||
* @link http://github.com/zendframework/zf2 for the canonical source repository | ||
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
|
||
namespace ZendTest\Mvc\Service\TestAsset; | ||
|
||
use Zend\Mvc\Router\RouteStackInterface; | ||
use Zend\Stdlib\RequestInterface as Request; | ||
|
||
class Router implements RouteStackInterface | ||
{ | ||
/** | ||
* Create a new route with given options. | ||
* | ||
* @param array|\Traversable $options | ||
* @return void | ||
*/ | ||
public static function factory($options = array()) | ||
{ | ||
return new static(); | ||
} | ||
|
||
/** | ||
* Match a given request. | ||
* | ||
* @param Request $request | ||
* @return RouteMatch|null | ||
*/ | ||
public function match(Request $request) | ||
{ | ||
} | ||
|
||
/** | ||
* Assemble the route. | ||
* | ||
* @param array $params | ||
* @param array $options | ||
* @return mixed | ||
*/ | ||
public function assemble(array $params = array(), array $options = array()) | ||
{ | ||
} | ||
|
||
/** | ||
* Add a route to the stack. | ||
* | ||
* @param string $name | ||
* @param mixed $route | ||
* @param int $priority | ||
* @return RouteStackInterface | ||
*/ | ||
public function addRoute($name, $route, $priority = null) | ||
{ | ||
} | ||
|
||
/** | ||
* Add multiple routes to the stack. | ||
* | ||
* @param array|\Traversable $routes | ||
* @return RouteStackInterface | ||
*/ | ||
public function addRoutes($routes) | ||
{ | ||
} | ||
|
||
/** | ||
* Remove a route from the stack. | ||
* | ||
* @param string $name | ||
* @return RouteStackInterface | ||
*/ | ||
public function removeRoute($name) | ||
{ | ||
} | ||
|
||
/** | ||
* Remove all routes from the stack and set new ones. | ||
* | ||
* @param array|\Traversable $routes | ||
* @return RouteStackInterface | ||
*/ | ||
public function setRoutes($routes) | ||
{ | ||
} | ||
} |