Completed
Push — master ( 90ccc1...22512f )
by Kamil
35:43
created

MetadataCompilerSpec::it_is_initializable()   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\Component\Metadata\Compiler;
13
14
use PhpSpec\ObjectBehavior;
15
use Sylius\Component\Metadata\Model\MetadataInterface;
16
17
/**
18
 * @mixin \Sylius\Component\Metadata\Compiler\MetadataCompiler
19
 *
20
 * @author Kamil Kokot <[email protected]>
21
 */
22
class MetadataCompilerSpec extends ObjectBehavior
23
{
24
    function it_is_initializable()
25
    {
26
        $this->shouldHaveType('Sylius\Component\Metadata\Compiler\MetadataCompiler');
27
    }
28
29
    function it_implements_Metadata_Compiler_interface()
30
    {
31
        $this->shouldImplement('Sylius\Component\Metadata\Compiler\MetadataCompilerInterface');
32
    }
33
34
    function it_clones_metadata_even_if_nothing_changes(
35
        MetadataInterface $childMetadata,
36
        MetadataInterface $parentMetadata
37
    ) {
38
        $childMetadata->merge($parentMetadata)->shouldBeCalled();
39
40
        $this->compile($childMetadata, [$parentMetadata])->shouldBeLike($childMetadata);
41
        $this->compile($childMetadata, [$parentMetadata])->shouldNotReturn($childMetadata);
42
    }
43
44
    function it_does_not_handle_exceptions_thrown_while_merging_metadata(
45
        MetadataInterface $childMetadata,
46
        MetadataInterface $parentMetadata
47
    ) {
48
        $childMetadata->merge($parentMetadata)->shouldBeCalled()->willThrow('\InvalidArgumentException');
49
50
        $this->shouldThrow('\InvalidArgumentException')->duringCompile($childMetadata, [$parentMetadata]);
51
    }
52
}
53