From bdf5b045a2570e2f87c2e798b162fd5a684ae17e Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Thu, 30 Jun 2016 15:27:36 -0500 Subject: [PATCH] Added CHANGELOG for #163 --- CHANGELOG.md | 32 +++++++++++++++++++++++- test/View/InjectTemplateListenerTest.php | 13 +++++----- 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ba470eb0..5c52cdd8a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,37 @@ All notable changes to this project will be documented in this file, in reverse ### Added -- Nothing. +- [#163](https://github.com/zendframework/zend-mvc/pull/163) adds support to the + `AcceptableViewModelSelector` plugin for controller maps in the `view_manager` + configuration in the format: + + ```php + [ + 'ControllerClassName' => 'view/name', + ] + ``` + + This fixes an issue observed when running with Apigility. + +- [#163](https://github.com/zendframework/zend-mvc/pull/163) adds support to the + `InjectTemplateListener` for specifying whether or not to prefer the + controller matched during routing via routing configuration: + + ```php + 'route-name' => [ + /* ... */ + 'options' => [ + /* ... */ + 'defaults' => [ + /* ... */ + 'prefer_route_match_controller' => true, + ], + ], + ], + ``` + + This allows actions that might otherwise skip injection of the template + to force the injection. ### Deprecated diff --git a/test/View/InjectTemplateListenerTest.php b/test/View/InjectTemplateListenerTest.php index f264d7358..fb5e11ae6 100644 --- a/test/View/InjectTemplateListenerTest.php +++ b/test/View/InjectTemplateListenerTest.php @@ -17,6 +17,7 @@ use Zend\Router\RouteMatch; use Zend\Mvc\View\Http\InjectTemplateListener; use Zend\View\Model\ViewModel; +use ZendTest\Mvc\Controller\TestAsset\SampleController; class InjectTemplateListenerTest extends TestCase { @@ -108,7 +109,7 @@ public function testBypassesTemplateInjectionIfResultViewModelAlreadyHasATemplat public function testMapsSubNamespaceToSubDirectory() { $myViewModel = new ViewModel(); - $myController = new \ZendTest\Mvc\Controller\TestAsset\SampleController(); + $myController = new SampleController(); $this->event->setTarget($myController); $this->event->setResult($myViewModel); @@ -158,7 +159,7 @@ public function testMapsSubNamespaceToSubDirectoryWithControllerFromEventTarget( $moduleRouteListener->onRoute($this->event); $myViewModel = new ViewModel(); - $myController = new \ZendTest\Mvc\Controller\TestAsset\SampleController(); + $myController = new SampleController(); $this->event->setTarget($myController); $this->event->setResult($myViewModel); @@ -183,7 +184,7 @@ public function testMapsSubNamespaceToSubDirectoryWithControllerFromEventTargetS $template1 = $myViewModel->getTemplate(); $myViewModel = new ViewModel(); - $myController = new \ZendTest\Mvc\Controller\TestAsset\SampleController(); + $myController = new SampleController(); $this->event->setTarget($myController); $this->event->setResult($myViewModel); @@ -204,7 +205,7 @@ public function testControllerMatchedByMapIsInflected() $this->listener->setControllerMap(['ZendTest' => true]); $myViewModel = new ViewModel(); - $myController = new \ZendTest\Mvc\Controller\TestAsset\SampleController(); + $myController = new SampleController(); $this->event->setTarget($myController); $this->event->setResult($myViewModel); @@ -332,7 +333,7 @@ public function testPrefersRouteMatchController() $this->listener->setPreferRouteMatchController(true); $this->routeMatch->setParam('controller', 'Some\Other\Service\Namespace\Controller\Sample'); $myViewModel = new ViewModel(); - $myController = new \ZendTest\Mvc\Controller\TestAsset\SampleController(); + $myController = new SampleController(); $this->event->setTarget($myController); $this->event->setResult($myViewModel); @@ -356,7 +357,7 @@ public function testPrefersRouteMatchControllerWithRouteMatchAndControllerMap() $this->listener->setControllerMap($controllerMap); $myViewModel = new ViewModel(); - $myController = new \ZendTest\Mvc\Controller\TestAsset\SampleController(); + $myController = new SampleController(); $this->event->setTarget($myController); $this->event->setResult($myViewModel);