From a8518ff38d20965c38aa354e6bf9abc47bf80d89 Mon Sep 17 00:00:00 2001 From: Natan Felles Date: Sun, 8 May 2022 16:21:17 -0300 Subject: [PATCH] Test debug comments on View --- tests/ViewTest.php | 29 +++++++++++++++++++++++++++++ tests/Views/comments.php | 17 +++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 tests/Views/comments.php diff --git a/tests/ViewTest.php b/tests/ViewTest.php index 72a25a4..bd56ac5 100644 --- a/tests/ViewTest.php +++ b/tests/ViewTest.php @@ -338,4 +338,33 @@ public function testDebugRender() : void $contents ); } + + public function testDebugComments() : void + { + $this->view->setDebugCollector(new ViewCollector()) + ->setLayoutPrefix('_layouts') + ->setIncludePrefix('_includes'); + $contents = $this->view->render('comments'); + self::assertSame( + <<<'EOL' + + +

Layout Default

+ + + CONTENTS + + + + + + + + + + + EOL, + $contents + ); + } } diff --git a/tests/Views/comments.php b/tests/Views/comments.php new file mode 100644 index 0000000..1c82475 --- /dev/null +++ b/tests/Views/comments.php @@ -0,0 +1,17 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +/** + * @var Framework\MVC\View $view + */ +$view->extends('default'); +$view->block('contents'); +echo 'CONTENTS' . \PHP_EOL; +echo $view->include('footer'); +$view->endBlock();