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

AbstractColumnSchemaBuilderTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getColumnSchemaBuilder() 0 3 1
A checkBuildString() 0 10 2
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