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

TranslationSpec   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 10
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 60
rs 10

10 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 4 1
A it_has_a_local_path() 0 4 1
A it_has_a_crowdin_path() 0 4 1
A it_has_no_title_by_default() 0 4 1
A it_has_no_export_pattern_by_default() 0 4 1
A its_local_path_should_be_mutable() 0 5 1
A its_crowdin_path_should_be_mutable() 0 5 1
A its_title_path_should_be_mutable() 0 5 1
A its_export_pattern_should_be_mutable() 0 5 1
A it_should_trow_an_exception_when_a_local_file_does_not_exist() 0 7 1
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