Skip to content

Commit

Permalink
Supplemented test case
Browse files Browse the repository at this point in the history
  • Loading branch information
batumibiz committed Dec 10, 2019
1 parent fe1e1d7 commit 6021697
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions test/Template/TemplateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,37 @@ public function testLayout(): void
$this->assertEquals($this->template->render(), 'Hello World');
}

/**
* @throws \Throwable
*/
public function testSectionReplace(): void
{
vfsStream::create(
[
'template.phtml' => '<?php $this->layout("folder::layout")?><?php $this->sectionReplace("test", "Hello World") ?>',
'layout.phtml' => '<?php echo $this->section("test") ?>',
]
);
$this->assertEquals($this->template->render(), 'Hello World');
}

public function testSectionAppend(): void
{
vfsStream::create(
[
'template.phtml' => implode(
'\n',
[
'<?php $this->layout("folder::layout")?><?php $this->sectionAppend("test", "Hello World") ?>',
'<?php $this->layout("folder::layout")?><?php $this->sectionAppend("test", "!!!") ?>',
]
),
'layout.phtml' => '<?php echo $this->section("test") ?>',
]
);
$this->assertEquals($this->template->render(), 'Hello World!!!');
}

/**
* @throws \Throwable
*/
Expand Down

0 comments on commit 6021697

Please sign in to comment.