Skip to content
Snippets Groups Projects
Commit 24aae866 authored by dyszczo's avatar dyszczo
Browse files

tests for dir resolver

parent 74462884
No related branches found
No related tags found
2 merge requests!8feat/woo template,!3Feature/implementation
<?php
use WPDesk\View\Resolver\Exception\CanNotResolve;
class TestDirResolver extends \PHPUnit\Framework\TestCase
{
const TEMPLATE_NAME = 'some_template';
const TEMPLATE_FILE = 'some_template.php';
const TEMPLATE_SUBDIR = 'templates';
public function testCanFindInDirPath()
{
$dir = __DIR__ . '/' . self::TEMPLATE_SUBDIR;
$resolver = new \WPDesk\View\Resolver\DirResolver($dir);
$this->assertStringEndsWith(self::TEMPLATE_FILE, $resolver->resolve(self::TEMPLATE_NAME),
'Template should be found in dir');
}
public function testThrowExceptionWhenCannotFind()
{
$this->expectException(CanNotResolve::class);
$resolver = new \WPDesk\View\Resolver\DirResolver('whatever');
$resolver->resolve('whatever2');
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment