Completed
Push — master ( 6f962e...549eec )
by Kamil
21:17
created

SettingsExtensionSpec::it_has_a_name()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 4
rs 10
c 1
b 0
f 1
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Sylius package.
5
 *
6
 * (c) Paweł Jędrzejewski
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace spec\Sylius\Bundle\ThemeBundle\Twig;
13
14
use PhpSpec\ObjectBehavior;
15
use Prophecy\Argument;
16
use Sylius\Bundle\SettingsBundle\Model\SettingsInterface;
17
use Sylius\Bundle\ThemeBundle\Context\ThemeContextInterface;
18
use Sylius\Bundle\ThemeBundle\Model\ThemeInterface;
19
use Sylius\Bundle\ThemeBundle\Settings\ThemeSettingsManagerInterface;
20
use Sylius\Bundle\ThemeBundle\Twig\SettingsExtension;
21
22
/**
23
 * @mixin SettingsExtension
24
 *
25
 * @author Kamil Kokot <[email protected]>
26
 */
27
final class SettingsExtensionSpec extends ObjectBehavior
28
{
29
    function let(ThemeContextInterface $themeContext, ThemeSettingsManagerInterface $themeSettingsManager)
30
    {
31
        $this->beConstructedWith($themeContext, $themeSettingsManager);
32
    }
33
34
    function it_is_initializable()
35
    {
36
        $this->shouldHaveType('Sylius\Bundle\ThemeBundle\Twig\SettingsExtension');
37
    }
38
39
    function it_is_a_Twig_extension()
40
    {
41
        $this->shouldHaveType(\Twig_Extension::class);
42
    }
43
44
    function it_returns_an_empty_array_if_there_is_no_current_theme_set(ThemeContextInterface $themeContext)
45
    {
46
        $themeContext->getTheme()->willReturn(null);
47
48
        $this->getThemeSettings()->shouldReturn([]);
49
    }
50
51
    function it_returns_loaded_theme_settings(
52
        ThemeContextInterface $themeContext,
53
        ThemeSettingsManagerInterface $themeSettingsManager,
54
        ThemeInterface $theme,
55
        SettingsInterface $settings
56
    ) {
57
        $themeContext->getTheme()->willReturn($theme);
58
59
        $themeSettingsManager->load($theme)->willReturn($settings);
60
61
        $this->getThemeSettings()->shouldReturn($settings);
62
    }
63
64
    function it_has_a_name()
65
    {
66
        $this->getName()->shouldReturn('sylius_theme_settings');
67
    }
68
}
69