Skip to content

Commit

Permalink
Test debug comments on View
Browse files Browse the repository at this point in the history
  • Loading branch information
natanfelles committed May 8, 2022
1 parent 36d8dd3 commit a8518ff
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/ViewTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'
<!-- Render start: comments -->
<!-- Layout start: _layouts/default -->
<h1>Layout Default</h1>
<!-- Block start: comments::contents -->
CONTENTS
<!-- Include start: _includes/footer -->
<footer>Footer</footer>
<!-- Include end: _includes/footer -->
<!-- Block end: comments::contents -->
<!-- Layout end: _layouts/default -->
<!-- Render end: comments -->
EOL,
$contents
);
}
}
17 changes: 17 additions & 0 deletions tests/Views/comments.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php
/*
* This file is part of Aplus Framework MVC Library.
*
* (c) Natan Felles <natanfelles@gmail.com>
*
* 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();

0 comments on commit a8518ff

Please sign in to comment.