Completed
Push — master ( 1e6b4e...d692a8 )
by Rafał
14:51
created

MultiTenancyExtensionSpec::let()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
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
use Twig_Extension;
22
23
class MultiTenancyExtensionSpec extends ObjectBehavior
24
{
25
    function let(TenantContextInterface $tenantContext)
26
    {
27
        $this->beConstructedWith($tenantContext);
28
    }
29
30
    function it_is_initializable()
31
    {
32
        $this->shouldHaveType(MultiTenancyExtension::class);
33
    }
34
35
    function it_is_a_twig_extension()
36
    {
37
        $this->shouldHaveType(Twig_Extension::class);
38
    }
39
40
    function it_should_return_global_variables(TenantInterface $tenant, TenantContextInterface $tenantContext)
41
    {
42
        $tenant->getSubdomain()->willReturn('example');
43
        $tenant->getName()->willReturn('example tenant');
44
        $tenantContext->getTenant()->shouldBeCalled()->willReturn($tenant);
45
46
        $globals = [
47
            'organization' => $tenant
48
        ];
49
50
        $this->getGlobals()->shouldReturn($globals);
51
    }
52
53
    function it_should_have_a_name()
54
    {
55
        $this->getName()->shouldReturn('swp_multi_tenancy');
56
    }
57
}
58