SyncFSCommandTest::testExecute()   B
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 26
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 1 Features 0
Metric Value
c 3
b 1
f 0
dl 0
loc 26
rs 8.8571
cc 1
eloc 15
nc 1
nop 0
1
<?php
2
3
namespace Velikonja\LabbyBundle\Test\Command;
4
5
use Symfony\Component\Console\Output\OutputInterface;
6
use Velikonja\LabbyBundle\Command\SyncFSCommand;
7
8
class SyncFSCommandTest extends CommandTestCase
9
{
10
    /**
11
     * Prepare environment.
12
     */
13
    public function setUp()
14
    {
15
        parent::setUp();
16
17
        $this->fs->mkdir(
18
            array(
19
                $this->tmpDir . '/src',
20
            )
21
        );
22
    }
23
24
    /**
25
     * Test simple execute of dump command.
26
     */
27
    public function testExecute()
28
    {
29
        $exitCode = $this->tester->run(
30
            array(
31
                'command' => SyncFSCommand::COMMAND_NAME
32
            ),
33
            array(
34
                'verbosity' => OutputInterface::VERBOSITY_DEBUG
35
            )
36
        );
37
38
        $display = trim($this->tester->getDisplay());
39
40
        $this->assertEquals(0, $exitCode, $display);
41
42
        $this->assertRegExp(
43
            '/Finished in [0-9\.]+ seconds!/',
44
            $display,
45
            'Wrong output of sync:fs command detected.'
46
        );
47
48
        $this->assertTrue(
49
            file_exists($this->tmpDir . '/dst'),
50
            'Did not sync. Have you changed config.yml?'
51
        );
52
    }
53
}
54