Passed
Pull Request — master (#277)
by Kirill
03:11
created

InitTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 5 1
A testInit() 0 11 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 InitTest extends ConsoleTest
18
{
19
    public function setUp(): void
20
    {
21
        parent::setUp();
22
23
        $this->app->getEnvironment()->set('SAFE_MIGRATIONS', true);
24
    }
25
26
    public function testInit(): void
27
    {
28
        /** @var Database $db */
29
        $db = $this->app->get(Database::class);
30
31
        $this->assertSame([], $db->getTables());
32
33
        $this->runCommandDebug('migrate:init');
34
35
        $t = $db->getTables()[0];
36
        $this->assertSame('migrations', $t->getName());
37
    }
38
}
39