diff options
author | Igor Scheller <igor.scheller@igorshp.de> | 2018-09-02 02:09:56 +0200 |
---|---|---|
committer | Igor Scheller <igor.scheller@igorshp.de> | 2018-09-02 02:09:56 +0200 |
commit | 9e217d87c095170460a8580d5215ddf7cbe639f4 (patch) | |
tree | 3b426fe52e70ef0f1395edcb354f1be4788ca329 /tests/Unit/Renderer/TwigServiceProviderTest.php | |
parent | ac48332166ce28fcb1a2fc130c7f5adbc760e42d (diff) |
Template refactoring to use twig
Diffstat (limited to 'tests/Unit/Renderer/TwigServiceProviderTest.php')
-rw-r--r-- | tests/Unit/Renderer/TwigServiceProviderTest.php | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/tests/Unit/Renderer/TwigServiceProviderTest.php b/tests/Unit/Renderer/TwigServiceProviderTest.php index 3cd0da4d..0d632633 100644 --- a/tests/Unit/Renderer/TwigServiceProviderTest.php +++ b/tests/Unit/Renderer/TwigServiceProviderTest.php @@ -2,6 +2,7 @@ namespace Engelsystem\Test\Unit\Renderer; +use Engelsystem\Config\Config; use Engelsystem\Renderer\TwigEngine; use Engelsystem\Renderer\TwigLoader; use Engelsystem\Renderer\TwigServiceProvider; @@ -10,6 +11,7 @@ use PHPUnit\Framework\MockObject\MockObject; use ReflectionClass as Reflection; use stdClass; use Twig_Environment as Twig; +use Twig_Extension_Core as TwigCore; use Twig_ExtensionInterface as ExtensionInterface; use Twig_LoaderInterface as TwigLoaderInterface; @@ -97,6 +99,12 @@ class TwigServiceProviderTest extends ServiceProviderTest $twigLoader = $this->createMock(TwigLoader::class); /** @var Twig|MockObject $twig */ $twig = $this->createMock(Twig::class); + /** @var Config|MockObject $config */ + $config = $this->createMock(Config::class); + /** @var TwigCore|MockObject $twigCore */ + $twigCore = $this->getMockBuilder(stdClass::class) + ->setMethods(['setTimezone']) + ->getMock(); $app = $this->getApp(['make', 'instance', 'tag', 'get']); @@ -125,13 +133,27 @@ class TwigServiceProviderTest extends ServiceProviderTest ['renderer.twigEngine', $twigEngine] ); - $app->expects($this->once()) + $app->expects($this->exactly(2)) ->method('get') - ->with('path.views') - ->willReturn($viewsPath); + ->withConsecutive(['path.views'], ['config']) + ->willReturnOnConsecutiveCalls($viewsPath, $config); $this->setExpects($app, 'tag', ['renderer.twigEngine', ['renderer.engine']]); + $config->expects($this->once()) + ->method('get') + ->with('timezone') + ->willReturn('The/World'); + + $twig->expects($this->once()) + ->method('getExtension') + ->with(TwigCore::class) + ->willReturn($twigCore); + + $twigCore->expects($this->once()) + ->method('setTimezone') + ->with('The/World'); + $serviceProvider = new TwigServiceProvider($app); $this->setExtensionsTo($serviceProvider, []); |