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
|
|
|
|