TestCase::checkFixture()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 5
c 2
b 0
f 0
dl 0
loc 9
rs 10
cc 3
nc 2
nop 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\ActiveRecord\Tests;
6
7
use Yiisoft\ActiveRecord\Tests\Support\DbHelper;
8
use Yiisoft\Db\Connection\ConnectionInterface;
9
10
class TestCase extends \PHPUnit\Framework\TestCase
11
{
12
    protected ConnectionInterface $db;
13
14
    protected function checkFixture(ConnectionInterface $db, string $tablename, bool $reset = false): void
15
    {
16
        $schema = $db->getSchema();
17
        $tableSchema = $schema->getTableSchema($tablename, true);
18
19
        if ($tableSchema === null || $reset) {
20
            DbHelper::loadFixture($db);
21
22
            $schema->refresh();
23
        }
24
    }
25
}
26