summaryrefslogtreecommitdiff
path: root/tests/Unit/Renderer/Twig/Extensions/GlobalsTest.php
blob: 6441904b5fd507ab98ba82bdb227099a30d1cc3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php

namespace Engelsystem\Test\Unit\Renderer\Twig\Extensions;

use Engelsystem\Renderer\Twig\Extensions\Globals;

class GlobalsTest extends ExtensionTest
{
    /**
     * @covers \Engelsystem\Renderer\Twig\Extensions\Globals::getGlobals
     */
    public function testGetGlobals()
    {
        global $user;
        $user = [];

        $extension = new Globals();

        $globals = $extension->getGlobals();
        $this->assertGlobalsExists('user', [], $globals);

        $user['foo'] = 'bar';
        $globals = $extension->getGlobals();
        $this->assertGlobalsExists('user', ['foo' => 'bar'], $globals);
    }
}