diff options
author | Igor Scheller <igor.scheller@igorshp.de> | 2018-08-26 02:54:52 +0200 |
---|---|---|
committer | Igor Scheller <igor.scheller@igorshp.de> | 2018-08-29 23:46:11 +0200 |
commit | bb3d16d273bb3e4552e4869dd22cb2c2d81f5387 (patch) | |
tree | 7de41548a5bd3a56aead1d9d528aa93e058e973a /tests/Unit/Renderer/TwigLoaderTest.php | |
parent | a1bc763a16ee8be109de5c9053fbc5eded53824e (diff) |
Added Twig template renderer, closes #338
Diffstat (limited to 'tests/Unit/Renderer/TwigLoaderTest.php')
-rw-r--r-- | tests/Unit/Renderer/TwigLoaderTest.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/Unit/Renderer/TwigLoaderTest.php b/tests/Unit/Renderer/TwigLoaderTest.php new file mode 100644 index 00000000..e6867643 --- /dev/null +++ b/tests/Unit/Renderer/TwigLoaderTest.php @@ -0,0 +1,31 @@ +<?php + +namespace Engelsystem\Test\Unit\Renderer; + +use Engelsystem\Renderer\TwigLoader; +use PHPUnit\Framework\TestCase; +use ReflectionClass as Reflection; + +class TwigLoaderTest extends TestCase +{ + /** + * @covers \Engelsystem\Renderer\TwigLoader::findTemplate + */ + public function testFindTemplate() + { + $loader = new TwigLoader(); + + $reflection = new Reflection(get_class($loader)); + $property = $reflection->getProperty('cache'); + $property->setAccessible(true); + + $realPath = __DIR__ . '/Stub/foo.twig'; + $property->setValue($loader, ['Stub/foo.twig' => $realPath]); + + $return = $loader->findTemplate('Stub/foo.twig'); + $this->assertEquals($realPath, $return); + + $return = $loader->findTemplate('Stub/foo'); + $this->assertEquals($realPath, $return); + } +} |