Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[#1] Ensure all DefaultRenderingStrategy behaviors are tested

- Tested base template accessors
- Tested result set to response object
  • Loading branch information...
commit bf8c548fb30c960748315d807a1b4bbea1c50fcd 1 parent 3d9aabe
@weierophinney weierophinney authored
Showing with 26 additions and 0 deletions.
  1. +26 −0 tests/Zend/Mvc/View/DefaultRendereringStrategyTest.php
View
26 tests/Zend/Mvc/View/DefaultRendereringStrategyTest.php
@@ -115,4 +115,30 @@ public function testWillRenderAlternateStrategyWhenSelected()
$expected = sprintf('content (%s): %s', json_encode(array('template' => 'content')), json_encode(array('foo' => 'bar')));
}
+
+ public function testBaseTemplateIsLayoutByDefault()
+ {
+ $this->assertEquals('layout', $this->strategy->getBaseTemplate());
+ }
+
+ public function testBaseTemplateIsMutable()
+ {
+ $this->strategy->setBaseTemplate('alternate/layout');
+ $this->assertEquals('alternate/layout', $this->strategy->getBaseTemplate());
+ }
+
+ public function testBypassesRenderingIfResultIsAResponse()
+ {
+ $renderer = new TestAsset\DumbStrategy();
+ $this->view->addRenderingStrategy(function ($e) use ($renderer) {
+ return $renderer;
+ }, 100);
+ $model = new Model\ViewModel(array('foo' => 'bar'));
+ $model->setOption('template', 'content');
+ $this->event->setViewModel($model);
+ $this->event->setResult($this->response);
+
+ $result = $this->strategy->render($this->event);
+ $this->assertSame($this->response, $result);
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.