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

Avoid needless Zend\Filter dependency #25

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/Renderer/PhpRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,11 @@ public function render($nameOrModel, $values = null)

$this->setVars(array_pop($this->__varsCache));

return $this->getFilterChain()->filter($this->__content); // filter output
if ($this->__filterChain instanceof FilterChain) {
return $this->__filterChain->filter($this->__content); // filter output
}

return $this->__content;
}

/**
Expand Down
10 changes: 10 additions & 0 deletions test/PhpRendererTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -442,4 +442,14 @@ public function testSharedInstanceHelper()
$this->assertEquals(2, $this->renderer->sharedinstance());
$this->assertEquals(3, $this->renderer->sharedinstance());
}

public function testDoesNotCallFilterChainIfNoFilterChainWasSet()
{
$this->renderer->resolver()->addPath(__DIR__ . '/_templates');

$result = $this->renderer->render('empty.phtml');

$this->assertContains('Empty view', $result);
$this->assertAttributeEmpty('__filterChain', $this->renderer);
}
}