Passed
Pull Request — master (#380)
by Wilmer
03:41 queued 44s
created

CommonColumnSchemaBuilderTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
dl 0
loc 17
rs 10
c 1
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A checkBuildString() 0 13 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Db\Tests\Common;
6
7
use PHPUnit\Framework\TestCase;
8
use Yiisoft\Db\Tests\Support\TestTrait;
9
10
use function array_shift;
11
use function call_user_func_array;
12
13
/**
14
 * @group mssql
15
 * @group mysql
16
 * @group pgsql
17
 * @group oracle
18
 * @group sqlite
19
 */
20
abstract class CommonColumnSchemaBuilderTest extends TestCase
21
{
22
    use TestTrait;
23
24
    protected function checkBuildString(string $expected, string $type, int|null $length, array $calls): void
25
    {
26
        $db = $this->getConnection();
27
28
        $schema = $db->getSchema();
29
        $builder = $schema->createColumnSchemaBuilder($type, $length);
30
31
        foreach ($calls as $call) {
32
            $method = array_shift($call);
33
            call_user_func_array([$builder, $method], $call);
34
        }
35
36
        $this->assertSame($expected, $builder->__toString());
37
    }
38
}
39