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

checkBuildString()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 5
c 1
b 0
f 0
nc 2
nop 4
dl 0
loc 10
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Db\Tests;
6
7
use PHPUnit\Framework\TestCase;
8
use Yiisoft\Db\Schema\ColumnSchemaBuilder;
9
10
use function array_shift;
11
use function call_user_func_array;
12
13
abstract class AbstractColumnSchemaBuilderTest extends TestCase
14
{
15
    public function getColumnSchemaBuilder(string $type, int|null $length = null): ColumnSchemaBuilder
16
    {
17
        return new ColumnSchemaBuilder($type, $length);
18
    }
19
20
    public function checkBuildString(string $expected, string $type, int|null $length, $calls): void
21
    {
22
        $builder = $this->getColumnSchemaBuilder($type, $length);
23
24
        foreach ($calls as $call) {
25
            $method = array_shift($call);
26
            call_user_func_array([$builder, $method], $call);
27
        }
28
29
        $this->assertEquals($expected, $builder->__toString());
30
    }
31
}
32