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

Commit

Permalink
Browse files Browse the repository at this point in the history
added another test with a 'live' controller
  • Loading branch information
mpinkston committed Oct 31, 2012
1 parent ac74896 commit 988bfad
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion tests/ZendTest/Mvc/View/InjectTemplateListenerTest.php
Expand Up @@ -103,7 +103,7 @@ public function testBypassesTemplateInjectionIfResultViewModelAlreadyHasATemplat
$this->assertEquals('custom', $model->getTemplate()); $this->assertEquals('custom', $model->getTemplate());
} }


public function testMapsSubNamespaceToSubDirectory() public function testMapsSubNamespaceToSubDirectoryWithControllerFromRouteMatch()
{ {
$this->routeMatch->setParam(ModuleRouteListener::MODULE_NAMESPACE, 'Aj\Controller\SweetAppleAcres\Reports'); $this->routeMatch->setParam(ModuleRouteListener::MODULE_NAMESPACE, 'Aj\Controller\SweetAppleAcres\Reports');
$this->routeMatch->setParam('controller', 'CiderSales'); $this->routeMatch->setParam('controller', 'CiderSales');
Expand All @@ -116,6 +116,21 @@ public function testMapsSubNamespaceToSubDirectory()
$this->assertEquals('sweet-apple-acres/reports/cider-sales/pinkie-pie-revenue', $model->getTemplate()); $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() public function testAttachesListenerAtExpectedPriority()
{ {
$events = new EventManager(); $events = new EventManager();
Expand Down

0 comments on commit 988bfad

Please sign in to comment.