Skip to content

Commit

Permalink
Added two more tests for InjectTemplateListener
Browse files Browse the repository at this point in the history
  • Loading branch information
Xerkus committed Jan 8, 2014
1 parent d627167 commit 0063122
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion tests/ZendTest/Mvc/View/InjectTemplateListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,25 @@ public function testControllerNotMatchedByMapIsNotAffected()
$this->assertEquals('zend-test/sample/test', $myViewModel->getTemplate());
}

public function testFullControllerNameMatchIsMapped()
{
$this->listener->setControllerMap(array(
'Foo\Bar\Controller\IndexController' => 'string-value',
));
$template = $this->listener->mapController('Foo\Bar\Controller\IndexController');
$this->assertEquals('string-value', $template);
}

public function testOnlyFullNamespaceMatchIsMapped()
{
$this->listener->setControllerMap(array(
'Foo' => 'foo-matched',
'Foo\Bar' => 'foo-bar-matched',
));
$template = $this->listener->mapController('Foo\BarBaz\Controller\IndexController');
$this->assertEquals('foo-matched/bar-baz/index', $template);
}

public function testControllerMapMatchedPrefixReplacedByStringValue()
{
$this->listener->setControllerMap(array(
Expand All @@ -173,7 +192,6 @@ public function testControllerMapMatchedPrefixReplacedByStringValue()
$this->assertEquals('string-value/index', $template);
}


public function testUsingNamespaceRouteParameterGivesSameResultAsFullControllerParameter()
{
$this->routeMatch->setParam('controller', 'MappedNs\Foo\Controller\Bar\Baz\Sample');
Expand Down

0 comments on commit 0063122

Please sign in to comment.