Completed
Push — vcraescu/fix_sorter ( 7a0f3b )
by Kamil
52:25 queued 30:01
created

its_translatable_is_mutable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
nc 1
cc 1
eloc 3
nop 1
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\Resource\Model;
13
14
use PhpSpec\ObjectBehavior;
15
use Prophecy\Argument;
16
use Sylius\Component\Resource\Model\AbstractTranslation;
17
use Sylius\Component\Resource\Model\TranslatableInterface;
18
use Sylius\Component\Resource\Model\TranslationInterface;
19
20
final class AbstractTranslationSpec extends ObjectBehavior
21
{
22
    function let()
23
    {
24
        $this->beAnInstanceOf('spec\Sylius\Component\Resource\Model\ConcreteTranslation');
25
    }
26
27
    function it_is_a_translation()
28
    {
29
        $this->shouldImplement(TranslationInterface::class);
30
    }
31
32
    function its_translatable_is_mutable(TranslatableInterface $translatable)
33
    {
34
        $this->setTranslatable($translatable);
35
        $this->getTranslatable()->shouldReturn($translatable);
36
    }
37
38
    function its_detaches_from_its_translatable_correctly(
39
        TranslatableInterface $translatable1,
40
        TranslatableInterface $translatable2
41
    ) {
42
        $translatable1->addTranslation(Argument::type(AbstractTranslation::class));
43
        $this->setTranslatable($translatable1);
44
45
        $translatable1->removeTranslation(Argument::type(AbstractTranslation::class));
46
        $translatable2->addTranslation(Argument::type(AbstractTranslation::class));
47
        $this->setTranslatable($translatable2);
48
    }
49
50
    function its_locale_is_mutable()
51
    {
52
        $this->setLocale('en');
53
        $this->getLocale()->shouldReturn('en');
54
    }
55
}
56
57
class ConcreteTranslation extends AbstractTranslation
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
58
{
59
}
60