TranslationSpec   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 10
lcom 0
cbo 1
dl 0
loc 59
rs 10
c 0
b 0
f 0

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