Completed
Push — 1.0 ( 06f541...30f90e )
by Kamil
76:33 queued 38:52
created

it_implements_translation_resource_interface()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
nc 1
cc 1
eloc 2
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
declare(strict_types=1);
13
14
namespace spec\Sylius\Bundle\ThemeBundle\Translation\Provider;
15
16
use PhpSpec\ObjectBehavior;
17
use Sylius\Bundle\ThemeBundle\Model\ThemeInterface;
18
use Sylius\Bundle\ThemeBundle\Translation\Resource\TranslationResourceInterface;
19
20
/**
21
 * @author Kamil Kokot <[email protected]>
22
 */
23
final class ThemeTranslationResourceSpec extends ObjectBehavior
24
{
25
    function let(ThemeInterface $theme): void
26
    {
27
        $theme->getName()->willReturn('theme/name');
28
29
        $this->beConstructedWith($theme, 'my-domain.my-locale.my-format');
30
    }
31
32
    function it_implements_translation_resource_interface(): void
33
    {
34
        $this->shouldImplement(TranslationResourceInterface::class);
35
    }
36
37
    function it_is_a_translation_resource_value_object(): void
38
    {
39
        $this->getName()->shouldReturn('my-domain.my-locale.my-format');
40
        $this->getDomain()->shouldReturn('my-domain');
41
        $this->getLocale()->shouldReturn('my-locale@theme-name');
42
        $this->getFormat()->shouldReturn('my-format');
43
    }
44
45
    function it_throws_an_invalid_argument_exception_if_failed_to_instantiate_with_given_filepath(ThemeInterface $theme): void
46
    {
47
        $theme->getName()->willReturn('theme/name');
48
49
        $this->beConstructedWith($theme, 'one.dot');
50
51
        $this->shouldThrow(\InvalidArgumentException::class)->duringInstantiation();
52
    }
53
}
54