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

Commit

Permalink
Changed PlatesTemplate to PlatesRenderer in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kynx committed Oct 10, 2015
1 parent 203402f commit 7cdab23
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions test/Template/PlatesRendererTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,11 @@ public function testProperlyResolvesNamespacedTemplate()

public function testAddParameterToOneTemplate()
{
$template = new PlatesTemplate();
$template->addPath(__DIR__ . '/TestAsset');
$renderer = new PlatesRenderer();
$renderer->addPath(__DIR__ . '/TestAsset');
$name = 'Plates';
$template->addParameters(['name' => $name], 'plates');
$result = $template->render('plates');
$renderer->addParameters(['name' => $name], 'plates');
$result = $renderer->render('plates');
$content = file_get_contents(__DIR__ . '/TestAsset/plates.php');
$content= str_replace('<?=$this->e($name)?>', $name, $content);
$this->assertEquals($content, $result);
Expand All @@ -201,7 +201,7 @@ public function testAddParameterToOneTemplate()
$this->assertContains('Undefined variable: name', $message);
return true;
}, E_NOTICE);
$template->render('plates-2');
$renderer->render('plates-2');
restore_error_handler();

$content= str_replace('<?=$this->e($name)?>', '', $content);
Expand All @@ -210,46 +210,46 @@ public function testAddParameterToOneTemplate()

public function testAddSharedParameters()
{
$template = new PlatesTemplate();
$template->addPath(__DIR__ . '/TestAsset');
$renderer = new PlatesRenderer();
$renderer->addPath(__DIR__ . '/TestAsset');
$name = 'Plates';
$template->addParameters(['name' => $name]);
$result = $template->render('plates');
$renderer->addParameters(['name' => $name]);
$result = $renderer->render('plates');
$content = file_get_contents(__DIR__ . '/TestAsset/plates.php');
$content= str_replace('<?=$this->e($name)?>', $name, $content);
$this->assertEquals($content, $result);
$result = $template->render('plates-2');
$result = $renderer->render('plates-2');
$content = file_get_contents(__DIR__ . '/TestAsset/plates-2.php');
$content= str_replace('<?=$this->e($name)?>', $name, $content);
$this->assertEquals($content, $result);
}

public function testOverrideSharedParametersPerTemplate()
{
$template = new PlatesTemplate();
$template->addPath(__DIR__ . '/TestAsset');
$renderer = new PlatesRenderer();
$renderer->addPath(__DIR__ . '/TestAsset');
$name = 'Plates';
$name2 = 'Saucers';
$template->addParameters(['name' => $name]);
$template->addParameters(['name' => $name2], 'plates-2');
$result = $template->render('plates');
$renderer->addParameters(['name' => $name]);
$renderer->addParameters(['name' => $name2], 'plates-2');
$result = $renderer->render('plates');
$content = file_get_contents(__DIR__ . '/TestAsset/plates.php');
$content= str_replace('<?=$this->e($name)?>', $name, $content);
$this->assertEquals($content, $result);
$result = $template->render('plates-2');
$result = $renderer->render('plates-2');
$content = file_get_contents(__DIR__ . '/TestAsset/plates-2.php');
$content= str_replace('<?=$this->e($name)?>', $name2, $content);
$this->assertEquals($content, $result);
}

public function testOverrideSharedParametersAtRender()
{
$template = new PlatesTemplate();
$template->addPath(__DIR__ . '/TestAsset');
$renderer = new PlatesRenderer();
$renderer->addPath(__DIR__ . '/TestAsset');
$name = 'Plates';
$name2 = 'Saucers';
$template->addParameters(['name' => $name]);
$result = $template->render('plates', ['name' => $name2]);
$renderer->addParameters(['name' => $name]);
$result = $renderer->render('plates', ['name' => $name2]);
$content = file_get_contents(__DIR__ . '/TestAsset/plates.php');
$content= str_replace('<?=$this->e($name)?>', $name2, $content);
$this->assertEquals($content, $result);
Expand Down

0 comments on commit 7cdab23

Please sign in to comment.