SyncCommandTest::setUp()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 1
eloc 5
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\SyncCommand;
7
8
class SyncCommandTest 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' => SyncCommand::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:db command detected.'
46
        );
47
48
        $dst = $this->tmpDir . '/dst';
49
        $this->assertTrue(
50
            file_exists($dst),
51
            sprintf(
52
                'Folder `%s` does not existing. I guess it did not sync.',
53
                $dst
54
            )
55
        );
56
    }
57
}
58