From 60216976a552dcee15af1706657cd1d48571658d Mon Sep 17 00:00:00 2001 From: Oleg Kasyanov Date: Wed, 11 Dec 2019 03:55:17 +0400 Subject: [PATCH] Supplemented test case --- test/Template/TemplateTest.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/test/Template/TemplateTest.php b/test/Template/TemplateTest.php index 647983c..7360656 100644 --- a/test/Template/TemplateTest.php +++ b/test/Template/TemplateTest.php @@ -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' => 'layout("folder::layout")?>sectionReplace("test", "Hello World") ?>', + 'layout.phtml' => 'section("test") ?>', + ] + ); + $this->assertEquals($this->template->render(), 'Hello World'); + } + + public function testSectionAppend(): void + { + vfsStream::create( + [ + 'template.phtml' => implode( + '\n', + [ + 'layout("folder::layout")?>sectionAppend("test", "Hello World") ?>', + 'layout("folder::layout")?>sectionAppend("test", "!!!") ?>', + ] + ), + 'layout.phtml' => 'section("test") ?>', + ] + ); + $this->assertEquals($this->template->render(), 'Hello World!!!'); + } + /** * @throws \Throwable */