SyncCommandTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 10 1
B testExecute() 0 30 1
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