Code Duplication    Length = 10-12 lines in 5 locations

Tests/Command/FormatCommandTest.php 5 locations

@@ 28-37 (lines=10) @@
25
    /**
26
     * Tests the execute method the FormatCommand
27
     */
28
    public function testExecute()
29
    {
30
        list($result, $output) = $this->runCommand([FormatCommand::COMMAND_NAME]);
31
32
        // check result code
33
        $this->assertEquals(0, $result);
34
35
        // output must end as expected
36
        $this->assertStringEndsWith(self::EXECUTE_OUTPUT_RESULT_OK, trim($output->fetch()));
37
    }
38
39
    /**
40
     * Tests the execute method the FormatCommand with a non-existing file
@@ 42-51 (lines=10) @@
39
    /**
40
     * Tests the execute method the FormatCommand with a non-existing file
41
     */
42
    public function testExecuteWithNonExistingFile()
43
    {
44
        list($result, $output) = $this->runCommand([FormatCommand::COMMAND_NAME, 'foo/bar/foobar.xlf']);
45
46
        // check result code
47
        $this->assertEquals(0, $result);
48
49
        // output must end as expected
50
        $this->assertContains(self::EXECUTE_OUTPUT_RESULT_FAIL, $output->fetch());
51
    }
52
53
    /**
54
     * Tests the execute method the FormatCommand with a file that should be ignored because of its file-ending
@@ 56-65 (lines=10) @@
53
    /**
54
     * Tests the execute method the FormatCommand with a file that should be ignored because of its file-ending
55
     */
56
    public function testExecuteWithIgnoredFile()
57
    {
58
        list($result, $output) = $this->runCommand([FormatCommand::COMMAND_NAME, 'ignored.txt']);
59
60
        // check result code
61
        $this->assertEquals(0, $result);
62
63
        // output must end as expected
64
        $this->assertContains(self::EXECUTE_OUTPUT_RESULT_FAIL, $output->fetch());
65
    }
66
67
    /**
68
     * Tests the execute method the FormatCommand with a file that should generate an error because of missing trans-units
@@ 70-81 (lines=12) @@
67
    /**
68
     * Tests the execute method the FormatCommand with a file that should generate an error because of missing trans-units
69
     */
70
    public function testExecuteWithoutTransUnits()
71
    {
72
        list($result, $output) = $this->runCommand(
73
            [FormatCommand::COMMAND_NAME, '../translations-faulty/no-trans-units.de.xlf']
74
        );
75
76
        // check result code
77
        $this->assertEquals(0, $result);
78
79
        // output must end as expected
80
        $this->assertContains(self::EXECUTE_OUTPUT_RESULT_FAIL_TRANS_UNITS, $output->fetch());
81
    }
82
83
    /**
84
     * Tests the execute method the FormatCommand with a file that should generate an error because of duplicate keys
@@ 86-97 (lines=12) @@
83
    /**
84
     * Tests the execute method the FormatCommand with a file that should generate an error because of duplicate keys
85
     */
86
    public function testExecuteWithDuplicateKeys()
87
    {
88
        list($result, $output) = $this->runCommand(
89
            [FormatCommand::COMMAND_NAME, '../translations-faulty/duplicate-keys.de.xlf']
90
        );
91
92
        // check result code
93
        $this->assertEquals(0, $result);
94
95
        // output must end as expected
96
        $this->assertContains(self::EXECUTE_OUTPUT_RESULT_FAIL_DUPLICATE_KEY, $output->fetch());
97
    }
98
99
    /**
100
     * Runs the command and returns the result of it along with the output object