Completed
Pull Request — master (#31)
by
unknown
03:24
created

FileReaderSpec::it_reads_a_stream()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace spec\Akeneo\Crowdin;
4
5
use Akeneo\Crowdin\Translation;
6
use PhpSpec\ObjectBehavior;
7
use Prophecy\Argument;
8
9
class FileReaderSpec extends ObjectBehavior
10
{
11
    const EXISTING_FILE_PATH = '/../../fixtures/messages.en.yml';
12
    const NOT_EXISTING_FILE_PATH = '/../../fixtures/not_existing.yml';
13
14
    public function it_reads_a_stream(Translation $translation)
15
    {
16
        $translation->getLocalPath()->willReturn(__DIR__ . self::EXISTING_FILE_PATH);
17
        $this->readTranslation($translation)->shouldBeResource();
18
    }
19
20
    public function it_throws_an_exception_when_file_cannot_be_found(Translation $translation)
21
    {
22
        $translation->getLocalPath()->willReturn(__DIR__ . self::NOT_EXISTING_FILE_PATH);
23
        $this
24
            ->shouldThrow('Akeneo\Crowdin\FileNotFoundException')
25
            ->during('readTranslation', [$translation]);
26
    }
27
}
28