Permalink
Browse files

added another test with a 'live' controller

  • Loading branch information...
mpinkston committed Oct 31, 2012
1 parent ac74896 commit 988bfadfe7605498eb2720962edf9bc3c1156ab3
Showing with 16 additions and 1 deletion.
  1. +16 −1 tests/ZendTest/Mvc/View/InjectTemplateListenerTest.php
@@ -103,7 +103,7 @@ public function testBypassesTemplateInjectionIfResultViewModelAlreadyHasATemplat
$this->assertEquals('custom', $model->getTemplate());
}
- public function testMapsSubNamespaceToSubDirectory()
+ public function testMapsSubNamespaceToSubDirectoryWithControllerFromRouteMatch()
{
$this->routeMatch->setParam(ModuleRouteListener::MODULE_NAMESPACE, 'Aj\Controller\SweetAppleAcres\Reports');
$this->routeMatch->setParam('controller', 'CiderSales');
@@ -116,6 +116,21 @@ public function testMapsSubNamespaceToSubDirectory()
$this->assertEquals('sweet-apple-acres/reports/cider-sales/pinkie-pie-revenue', $model->getTemplate());
}
+ public function testMapsSubNamespaceToSubDirectoryWithControllerFromEventTarget()
+ {
+ $this->routeMatch->setParam(ModuleRouteListener::MODULE_NAMESPACE, 'ZendTest\Mvc\Controller\TestAsset');
+ $this->routeMatch->setParam('action', 'test');
+
+ $myViewModel = new ViewModel();
+ $myController = new \ZendTest\Mvc\Controller\TestAsset\SampleController();
+
+ $this->event->setTarget($myController);
+ $this->event->setResult($myViewModel);
+ $this->listener->injectTemplate($this->event);
+
+ $this->assertEquals('zend-test/controller/test-asset/sample/test', $myViewModel->getTemplate());
+ }
+
public function testAttachesListenerAtExpectedPriority()
{
$events = new EventManager();

0 comments on commit 988bfad

Please sign in to comment.