MultiTenancyExtensionSpec   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 3
dl 0
loc 35
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 4 1
A it_is_initializable() 0 4 1
A it_is_a_twig_extension() 0 4 1
A it_should_return_global_variables() 0 12 1
A it_should_have_a_name() 0 4 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
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