SyncDbCommandTest::testExecute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 21
rs 9.3142
cc 1
eloc 12
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\SyncDBCommand;
7
8
class SyncDbCommandTest extends CommandTestCase
9
{
10
    /**
11
     * Test simple execute of dump command.
12
     */
13
    public function testExecute()
14
    {
15
        $exitCode = $this->tester->run(
16
            array(
17
                'command' => SyncDbCommand::COMMAND_NAME
18
            ),
19
            array(
20
                'verbosity' => OutputInterface::VERBOSITY_DEBUG
21
            )
22
        );
23
24
        $display = trim($this->tester->getDisplay());
25
26
        $this->assertEquals(0, $exitCode, $display);
27
28
        $this->assertRegExp(
29
            '/Finished in [0-9\.]+ seconds!/',
30
            $display,
31
            'Wrong output of sync:db command detected.'
32
        );
33
    }
34
35
    /**
36
     * Test first drops test database and then runs basic execute to check if db_recreate works.
37
     */
38
    public function testExecuteWithoutExistingDatabase()
39
    {
40
        $this->dropTestDB();
41
        $this->testExecute();
42
    }
43
}
44