Completed
Push — master ( 766aca...d9f01f )
by Nicolas
7s
created

FileReaderSpec   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A it_reads_a_stream() 0 5 1
A it_throws_an_exception_when_file_cannot_be_found() 0 7 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