Completed
Push — master ( b14360...d98453 )
by Rafał
12:25
created

TenantChoiceTypeSpec::it_should_build_form()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 10
rs 9.4285
cc 1
eloc 7
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Superdesk Web Publisher MultiTenancy Bundle.
7
 *
8
 * Copyright 2017 Sourcefabric z.ú. and contributors.
9
 *
10
 * For the full copyright and license information, please see the
11
 * AUTHORS and LICENSE files distributed with this source code.
12
 *
13
 * @copyright 2017 Sourcefabric z.ú
14
 * @license http://www.superdesk.org/license
15
 */
16
17
namespace spec\SWP\Bundle\MultiTenancyBundle\Form\Type;
18
19
use PhpSpec\ObjectBehavior;
20
use SWP\Bundle\MultiTenancyBundle\Form\Type\TenantChoiceType;
21
use SWP\Component\MultiTenancy\Context\TenantContextInterface;
22
use SWP\Component\MultiTenancy\Repository\TenantRepositoryInterface;
23
use Symfony\Bridge\Doctrine\Form\DataTransformer\CollectionToArrayTransformer;
24
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
25
use Symfony\Component\Form\FormBuilderInterface;
26
use Symfony\Component\Form\FormTypeInterface;
27
28
final class TenantChoiceTypeSpec extends ObjectBehavior
29
{
30
    public function let(TenantRepositoryInterface $tenantRepository, TenantContextInterface $tenantContext)
31
    {
32
        $this->beConstructedWith($tenantRepository, $tenantContext);
33
    }
34
35
    public function it_is_initializable()
36
    {
37
        $this->shouldHaveType(TenantChoiceType::class);
38
    }
39
40
    public function it_should_be_a_form_type()
41
    {
42
        $this->shouldHaveType(FormTypeInterface::class);
43
    }
44
45
    public function it_should_build_form(
46
        FormBuilderInterface $builder
47
    ) {
48
        $builder
49
            ->addModelTransformer(
50
                new CollectionToArrayTransformer()
51
            )->shouldBeCalled();
52
53
        $this->buildForm($builder, ['multiple' => true]);
54
    }
55
56
    public function it_has_block_prefix()
57
    {
58
        $this->getBlockPrefix()->shouldReturn('swp_tenant');
59
    }
60
61
    public function it_should_have_a_parent()
62
    {
63
        $this->getParent()->shouldReturn(ChoiceType::class);
64
    }
65
}
66