MultiTenancyExtensionSpec::it_is_initializable()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the Superdesk Web Publisher MultiTenancy Component.
5
 *
6
 * Copyright 2016 Sourcefabric z.u. and contributors.
7
 *
8
 * For the full copyright and license information, please see the
9
 * AUTHORS and LICENSE files distributed with this source code.
10
 *
11
 * @copyright 2016 Sourcefabric z.ú
12
 * @license http://www.superdesk.org/license
13
 */
14
15
namespace spec\SWP\Bundle\MultiTenancyBundle\Twig;
16
17
use PhpSpec\ObjectBehavior;
18
use SWP\Bundle\MultiTenancyBundle\Twig\MultiTenancyExtension;
19
use SWP\Component\MultiTenancy\Context\TenantContextInterface;
20
use SWP\Component\MultiTenancy\Model\TenantInterface;
21
22
/**
23
 * @mixin MultiTenancyExtension
24
 */
25
class MultiTenancyExtensionSpec extends ObjectBehavior
26
{
27
    public function let(TenantContextInterface $tenantContext)
28
    {
29
        $this->beConstructedWith($tenantContext);
30
    }
31
32
    public function it_is_initializable()
33
    {
34
        $this->shouldHaveType('SWP\Bundle\MultiTenancyBundle\Twig\MultiTenancyExtension');
35
    }
36
37
    public function it_is_a_twig_extension()
38
    {
39
        $this->shouldHaveType('Twig_Extension');
40
    }
41
42
    public function it_should_return_global_variables(TenantInterface $tenant, TenantContextInterface $tenantContext)
43
    {
44
        $tenant->getSubdomain()->willReturn('example');
45
        $tenant->getName()->willReturn('example tenant');
46
        $tenantContext->getTenant()->shouldBeCalled()->willReturn($tenant);
47
48
        $globals = [
49
            'tenant' => $tenant,
50
        ];
51
52
        $this->getGlobals()->shouldReturn($globals);
53
    }
54
55
    public function it_should_have_a_name()
56
    {
57
        $this->getName()->shouldReturn('swp_multi_tenancy');
58
    }
59
}
60