summaryrefslogtreecommitdiff
path: root/tests/Unit/Renderer
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2018-09-25 17:33:31 +0200
committermsquare <msquare@notrademark.de>2018-10-30 21:13:56 +0100
commit7f61dc95be4ac543986c7df2459532fd8f81368d (patch)
tree930497c659bbaa3e073313a261f3458348fd423d /tests/Unit/Renderer
parent63d1292bf80d88be40eec7695c1a59f29e6609c5 (diff)
EventConfig: Merge event configuration from database to global config
Diffstat (limited to 'tests/Unit/Renderer')
-rw-r--r--tests/Unit/Renderer/Twig/Extensions/GlobalsTest.php31
1 files changed, 1 insertions, 30 deletions
diff --git a/tests/Unit/Renderer/Twig/Extensions/GlobalsTest.php b/tests/Unit/Renderer/Twig/Extensions/GlobalsTest.php
index cdd9cd2a..6441904b 100644
--- a/tests/Unit/Renderer/Twig/Extensions/GlobalsTest.php
+++ b/tests/Unit/Renderer/Twig/Extensions/GlobalsTest.php
@@ -2,54 +2,25 @@
namespace Engelsystem\Test\Unit\Renderer\Twig\Extensions;
-use Carbon\Carbon;
use Engelsystem\Renderer\Twig\Extensions\Globals;
-use PHPUnit\Framework\MockObject\MockObject;
class GlobalsTest extends ExtensionTest
{
/**
* @covers \Engelsystem\Renderer\Twig\Extensions\Globals::getGlobals
- * @covers \Engelsystem\Renderer\Twig\Extensions\Globals::filterEventConfig
*/
public function testGetGlobals()
{
global $user;
$user = [];
- /** @var Globals|MockObject $extension */
- $extension = $this->getMockBuilder(Globals::class)
- ->setMethods(['getEventConfig'])
- ->getMock();
-
- $extension->expects($this->exactly(2))
- ->method('getEventConfig')
- ->willReturnOnConsecutiveCalls(
- null,
- [
- 'lorem' => 'ipsum',
- 'event_end_date' => 1234567890,
- ]
- );
+ $extension = new Globals();
$globals = $extension->getGlobals();
-
$this->assertGlobalsExists('user', [], $globals);
- $this->assertGlobalsExists('event_config', [], $globals);
$user['foo'] = 'bar';
-
$globals = $extension->getGlobals();
$this->assertGlobalsExists('user', ['foo' => 'bar'], $globals);
- $this->assertGlobalsExists('event_config', ['lorem' => 'ipsum'], $globals);
-
- $config = $globals['event_config'];
- $this->assertArrayHasKey('event_end_date', $config);
- /** @var Carbon $eventEndDate */
- $eventEndDate = $config['event_end_date'];
- $this->assertInstanceOf(Carbon::class, $eventEndDate);
-
- $eventEndDate->setTimezone('UTC');
- $this->assertEquals('2009-02-13 23:31:30', $eventEndDate->format('Y-m-d H:i:s'));
}
}