feature/current-namespaces #1
28
tests/ViewTest.php
Normal file
28
tests/ViewTest.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
class ViewTest extends TestCase
|
||||||
|
{
|
||||||
|
public function testRender(): void
|
||||||
|
{
|
||||||
|
$response = $this->getMockBuilder(Psr\Http\Message\ResponseInterface::class)
|
||||||
|
->disableOriginalConstructor()
|
||||||
|
->getMock();
|
||||||
|
$templatesFolder = './templates';
|
||||||
|
mkdir($templatesFolder);
|
||||||
|
$cacheFolder = './cache';
|
||||||
|
mkdir($cacheFolder);
|
||||||
|
chmod($cacheFolder, 0o777);
|
||||||
|
|
||||||
|
$templateName = 'test';
|
||||||
|
$template = <<<TEMPLATE
|
||||||
|
Test Template
|
||||||
|
TEMPLATE;
|
||||||
|
file_put_contents("{$templatesFolder}/{$templateName}.blade.php", $template);
|
||||||
|
|
||||||
|
$view = new View\Implement\View($templatesFolder, $cacheFolder);
|
||||||
|
|
||||||
|
$result = $view->render($response, $templateName);
|
||||||
|
$this->assertEquals($template, $result->getBody()->getContenst());
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user