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

Commit

Permalink
Merge branch 'hotfix/zend-router'
Browse files Browse the repository at this point in the history
Close #4
  • Loading branch information
weierophinney committed Mar 29, 2016
2 parents b6d2a7e + 292eb3c commit 4f8290c
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 116 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ All notable changes to this project will be documented in this file, in reverse

### Fixed

- Nothing.
- [#4](https://github.com/zendframework/zend-mvc-console/pull/4) updates the
code base to work with zendframework/zend-mvc@e1e42c33. As that revision (a)
removes console-related functionality, and (b) removes routing functionality,
it detailed further changes to this component required to ensure it runs
correctly as a module.

## 1.1.0 - 2016-03-23

Expand Down
42 changes: 21 additions & 21 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 24 additions & 1 deletion src/ConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ class ConfigProvider
public function __invoke()
{
return [
'dependencies' => $this->getDependencyConfig(),
'controller_plugins' => $this->getPluginConfig(),
'dependencies' => $this->getDependencyConfig(),
];
}

Expand Down Expand Up @@ -57,4 +58,26 @@ public function getDependencyConfig()
],
];
}

/**
* Provide controller plugin configuration for this component.
*
* @return array
*/
public function getPluginConfig()
{
// @codingStandardsIgnoreStart
return [
'aliases' => [
'CreateConsoleNotFoundModel' => Controller\Plugin\CreateConsoleNotFoundModel::class,
'createConsoleNotFoundModel' => Controller\Plugin\CreateConsoleNotFoundModel::class,
'createconsolenotfoundmodel' => Controller\Plugin\CreateConsoleNotFoundModel::class,
'Zend\Mvc\Controller\Plugin\CreateConsoleNotFoundModel::class' => Controller\Plugin\CreateConsoleNotFoundModel::class,
],
'factories' => [
Controller\Plugin\CreateConsoleNotFoundModel::class => InvokableFactory::class,
],
];
// @codingStandardsIgnoreEnd
}
}
1 change: 1 addition & 0 deletions src/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public function getConfig()
{
$provider = new ConfigProvider();
return [
'controller_plugins' => $provider->getPluginConfig(),
'service_manager' => $provider->getDependencyConfig(),
'console' => ['router' => ['routes' => []]],
];
Expand Down
52 changes: 0 additions & 52 deletions src/Service/ControllerPluginManagerDelegatorFactory.php

This file was deleted.

8 changes: 7 additions & 1 deletion test/Controller/ConsoleControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
use Zend\Mvc\Console\View\ViewModel;
use Zend\Mvc\Controller\PluginManager;
use Zend\Mvc\MvcEvent;
use Zend\Mvc\Router\RouteMatch;
use Zend\Router\RouteMatch;
use Zend\ServiceManager\Factory\InvokableFactory;

class ConsoleControllerTest extends TestCase
{
Expand All @@ -28,6 +29,11 @@ class ConsoleControllerTest extends TestCase
public function setUp()
{
$this->controller = new TestAsset\ConsoleController();

$plugins = $this->controller->getPluginManager();
$plugins->setAlias('createConsoleNotFoundModel', CreateConsoleNotFoundModel::class);
$plugins->setFactory(CreateConsoleNotFoundModel::class, InvokableFactory::class);

$routeMatch = new RouteMatch(['controller' => 'controller-sample']);
$event = new MvcEvent();
$event->setRouteMatch($routeMatch);
Expand Down
38 changes: 0 additions & 38 deletions test/Service/ControllerPluginManagerDelegatorFactoryTest.php

This file was deleted.

17 changes: 15 additions & 2 deletions test/View/ViewManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,21 @@
use Zend\EventManager\Test\EventListenerIntrospectionTrait;
use Zend\Mvc\Application;
use Zend\Mvc\MvcEvent;
use Zend\Mvc\Console\Service\ConsoleExceptionStrategyFactory;
use Zend\Mvc\Console\Service\ConsoleRouteNotFoundStrategyFactory;
use Zend\Mvc\Console\Service\ConsoleViewManagerFactory;
use Zend\Mvc\Console\Service\DefaultRenderingStrategyFactory;
use Zend\Mvc\Console\View\DefaultRenderingStrategy;
use Zend\Mvc\Console\View\ExceptionStrategy;
use Zend\Mvc\Console\View\CreateViewModelListener;
use Zend\Mvc\Console\View\InjectNamedConsoleParamsListener;
use Zend\Mvc\Console\View\InjectViewModelListener;
use Zend\Mvc\Console\View\Renderer;
use Zend\Mvc\Console\View\RouteNotFoundStrategy;
use Zend\Mvc\Console\View\ViewManager;
use Zend\Mvc\Service\ServiceListenerFactory;
use Zend\Mvc\Service\ServiceManagerConfig;
use Zend\ServiceManager\Factory\InvokableFactory;
use Zend\ServiceManager\ServiceManager;
use Zend\Stdlib\DispatchableInterface;
use Zend\View\View;
Expand Down Expand Up @@ -243,6 +248,10 @@ public function testConsoleKeyWillOverrideDisplayExceptionAndExceptionMessage($c
$this->services->setService('EventManager', $eventManager);
$this->services->setService('Request', $request);
$this->services->setService('Response', $response);
$this->services->setFactory('ConsoleRouteNotFoundStrategy', ConsoleRouteNotFoundStrategyFactory::class);
$this->services->setFactory('ConsoleExceptionStrategy', ConsoleExceptionStrategyFactory::class);
$this->services->setFactory('ConsoleDefaultRenderingStrategy', DefaultRenderingStrategyFactory::class);
$this->services->setFactory(Renderer::class, InvokableFactory::class);
$this->services->setAllowOverride(false);

$manager = $this->factory->__invoke($this->services, 'ConsoleViewRenderer');
Expand Down Expand Up @@ -271,6 +280,10 @@ public function testConsoleDisplayExceptionIsTrue()
$this->services->setService('EventManager', $eventManager);
$this->services->setService('Request', $request);
$this->services->setService('Response', $response);
$this->services->setFactory('ConsoleRouteNotFoundStrategy', ConsoleRouteNotFoundStrategyFactory::class);
$this->services->setFactory('ConsoleExceptionStrategy', ConsoleExceptionStrategyFactory::class);
$this->services->setFactory('ConsoleDefaultRenderingStrategy', DefaultRenderingStrategyFactory::class);
$this->services->setFactory(Renderer::class, InvokableFactory::class);
$this->services->setAllowOverride(false);

$manager = new ViewManager;
Expand All @@ -281,11 +294,11 @@ public function testConsoleDisplayExceptionIsTrue()
$manager->onBootstrap($event);

$exceptionStrategy = $this->services->get('ConsoleExceptionStrategy');
$this->assertInstanceOf('Zend\Mvc\View\Console\ExceptionStrategy', $exceptionStrategy);
$this->assertInstanceOf(ExceptionStrategy::class, $exceptionStrategy);
$this->assertTrue($exceptionStrategy->displayExceptions());

$routeNotFoundStrategy = $this->services->get('ConsoleRouteNotFoundStrategy');
$this->assertInstanceOf('Zend\Mvc\View\Console\RouteNotFoundStrategy', $routeNotFoundStrategy);
$this->assertInstanceOf(RouteNotFoundStrategy::class, $routeNotFoundStrategy);
$this->assertTrue($routeNotFoundStrategy->displayNotFoundReason());
}

Expand Down

0 comments on commit 4f8290c

Please sign in to comment.