FormatServiceTest::testFormat()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 21
rs 9.3142
c 1
b 0
f 1
cc 1
eloc 10
nc 1
nop 0
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
}