Reworked Controller around new Display class
This commit is contained in:
parent
4c0632cb4c
commit
064b4d9f55
3 changed files with 136 additions and 182 deletions
|
@ -54,16 +54,21 @@ class DisplayTest extends PHPUnit_Framework_TestCase
|
|||
|
||||
public function testNoParentTemplate()
|
||||
{
|
||||
file_put_contents(SITE_TEMPLATE_PATH . 'test.phtml', $this->child_html);
|
||||
$child_template = SITE_TEMPLATE_PATH . 'test.phtml';
|
||||
file_put_contents($child_template, $this->child_html);
|
||||
|
||||
$this->display->templates = [$child_template];
|
||||
|
||||
$this->assertEquals($this->child_html, $this->display->render());
|
||||
}
|
||||
|
||||
public function testRenderTemplate()
|
||||
{
|
||||
file_put_contents(SITE_TEMPLATE_PATH . 'test.phtml', $this->child_html);
|
||||
$child_template = SITE_TEMPLATE_PATH . 'test.phtml';
|
||||
file_put_contents($child_template, $this->child_html);
|
||||
|
||||
$child = '<?php require $this->template; ?>' . "\n";
|
||||
// Vim syntax highlighting borks unless ----v
|
||||
$child = '<?php require $this->template; ?' . '>' . "\n";
|
||||
|
||||
$html = <<<HTML
|
||||
<!doctype html>
|
||||
|
@ -76,11 +81,13 @@ class DisplayTest extends PHPUnit_Framework_TestCase
|
|||
</html>
|
||||
HTML;
|
||||
|
||||
file_put_contents($this->shared_templates . 'index.phtml', $html);
|
||||
$parent_template = $this->shared_templates . 'index.phtml';
|
||||
file_put_contents($parent_template, $html);
|
||||
|
||||
$html = str_replace($child, $this->child_html, $html);
|
||||
$html = preg_replace(['/^[\s]+/m', '/<!--(?:(?!BuySellAds).)+-->/U'], '', $html);
|
||||
|
||||
$this->display->templates = [$parent_template, $child_template];
|
||||
$this->assertEquals($html, $this->display->render());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue