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

StatusTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 27
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A testMigrate() 0 25 1
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