FormatServiceTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A testFormat() 0 21 1
1
<?php
2
3
namespace Decline\TransformatBundle\Tests\Services;
4
5
use Decline\TransformatBundle\Tests\ContainerTestCase;
6
use Decline\TransformatBundle\Tests\Services\Interfaces\ServiceTestInterface;
7
8
/**
9
 * Class FormatServiceTest
10
 * @package Decline\TransformatBundle\Tests\Services
11
 */
12
class FormatServiceTest extends ContainerTestCase implements ServiceTestInterface
13
{
14
15
    /**
16
     * Tests the actual formatting / ordering of the files content
17
     */
18
    public function testFormat()
19
    {
20
        $fileSystem = static::$container->get('filesystem');
21
        $formatService = static::$container->get('decline_transformat.format');
22
23
        $fileUnformatted = static::RESOURCES_DIR . '/' . static::TRANSLATION_UNFORMATTED;
24
        $fileFormatted = static::RESOURCES_DIR . '/' . static::TRANSLATION_FORMATTED;
25
        $fileExpected = static::RESOURCES_DIR . '/' . static::TRANSLATION_EXPECTED;
26
27
        // create a copy of the unformatted file
28
        $fileSystem->copy($fileUnformatted, $fileFormatted);
29
30
        // format the unformatted file
31
        $formatService->format(null, '../' . static::TRANSLATION_FORMATTED);
32
33
        // formatted file should be equal to expected file
34
        $this->assertFileEquals($fileExpected, $fileFormatted);
35
36
        // cleanup by removing formatted file
37
        $fileSystem->remove([$fileFormatted]);
38
    }
39
}