Completed
Push — master ( eb5568...bc1b58 )
by Nicolas
9s
created

TranslationSpec::let()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace spec\Akeneo\Crowdin;
4
5
use PhpSpec\ObjectBehavior;
6
use Prophecy\Argument;
7
8
class TranslationSpec extends ObjectBehavior
9
{
10
    function let()
11
    {
12
        $this->beConstructedWith(__DIR__ . '/../../fixtures/messages.en.yml', 'crowdin_path');
13
    }
14
15
    function it_has_a_local_path()
16
    {
17
        $this->getLocalPath()->shouldReturn(__DIR__ . '/../../fixtures/messages.en.yml');
18
    }
19
20
    function it_has_a_crowdin_path()
21
    {
22
        $this->getCrowdinPath()->shouldReturn('crowdin_path');
23
    }
24
25
    function it_has_no_title_by_default()
26
    {
27
        $this->getTitle()->shouldReturn(null);
28
    }
29
30
    function it_has_no_export_pattern_by_default()
31
    {
32
        $this->getExportPattern()->shouldReturn(null);
33
    }
34
35
    function its_local_path_should_be_mutable()
36
    {
37
        $this->setLocalPath(__DIR__ . '/../../fixtures/messages.en.yml');
38
        $this->getLocalPath()->shouldReturn(__DIR__ . '/../../fixtures/messages.en.yml');
39
    }
40
41
    function its_crowdin_path_should_be_mutable()
42
    {
43
        $this->setCrowdinPath('my/path/to/crowdin.yml');
44
        $this->getCrowdinPath()->shouldReturn('my/path/to/crowdin.yml');
45
    }
46
47
    function its_title_path_should_be_mutable()
48
    {
49
        $this->setTitle('The title of my translation');
50
        $this->getTitle()->shouldReturn('The title of my translation');
51
    }
52
53
    function its_export_pattern_should_be_mutable()
54
    {
55
        $this->setExportPattern('my/path/to/crowdin%two_letters_code%.yml');
56
        $this->getExportPattern()->shouldReturn('my/path/to/crowdin%two_letters_code%.yml');
57
    }
58
59
    function it_should_trow_an_exception_when_a_local_file_does_not_exist()
60
    {
61
        $this
62
            ->shouldThrow(new \InvalidArgumentException('File local_path does not exist'))
63
            ->duringSetLocalPath('local_path')
64
        ;
65
    }
66
67
}
68