Completed
Push — master ( 17598f...abee1f )
by Kirill
13s queued 11s
created

StatusTest::testMigrate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 25
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 15
nc 1
nop 0
dl 0
loc 25
rs 9.7666
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Spiral Framework.
5
 *
6
 * @license   MIT
7
 * @author    Anton Titov (Wolfy-J)
8
 */
9
10
declare(strict_types=1);
11
12
namespace Spiral\Tests\Framework\Migrate;
13
14
use Spiral\Database\Database;
15
use Spiral\Tests\Framework\ConsoleTest;
16
17
class StatusTest extends ConsoleTest
18
{
19
    public function testMigrate(): void
20
    {
21
        /** @var Database $db */
22
        $db = $this->app->get(Database::class);
23
        $this->assertSame([], $db->getTables());
24
25
        $out = $this->runCommandDebug('migrate:status');
26
        $this->assertStringContainsString('not', $out);
27
28
        $this->runCommandDebug('migrate:init');
29
30
        $out = $this->runCommandDebug('migrate:status');
31
        $this->assertStringContainsString('No', $out);
32
33
        $this->runCommandDebug('cycle:migrate');
34
        $this->assertSame(1, count($db->getTables()));
35
36
        $out = $this->runCommandDebug('migrate:status');
37
        $this->assertStringContainsString('not executed yet', $out);
38
39
        $this->runCommandDebug('migrate');
40
        $this->assertSame(3, count($db->getTables()));
41
42
        $out2 = $this->runCommandDebug('migrate:status');
43
        $this->assertNotSame($out, $out2);
44
    }
45
}
46