Skip to content

Commit cf7f4b5

Browse files
Remove src\TestSupport\TestColumnSchemaBuilderTrait from yiisoft\db. (#151)
* Remove src\TestSupport\TestColumnSchemaBuilderTrait from yiisoft\db.
1 parent 6bd568c commit cf7f4b5

2 files changed

Lines changed: 34 additions & 27 deletions

File tree

tests/ColumnSchemaBuilderTest.php

Lines changed: 8 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,22 @@
44

55
namespace Yiisoft\Db\Sqlite\Tests;
66

7-
use Yiisoft\Db\Sqlite\ColumnSchemaBuilder;
8-
use Yiisoft\Db\Sqlite\Schema;
9-
use Yiisoft\Db\TestSupport\TestColumnSchemaBuilderTrait;
7+
use Yiisoft\Db\Sqlite\Tests\Support\TestTrait;
8+
use Yiisoft\Db\Tests\Common\CommonColumnSchemaBuilderTest;
109

1110
/**
1211
* @group sqlite
12+
*
13+
* @psalm-suppress PropertyNotSetInConstructor
1314
*/
14-
final class ColumnSchemaBuilderTest extends TestCase
15+
final class ColumnSchemaBuilderTest extends CommonColumnSchemaBuilderTest
1516
{
16-
use TestColumnSchemaBuilderTrait;
17-
18-
public function getColumnSchemaBuilder($type, $length = null): ColumnSchemaBuilder
19-
{
20-
return new ColumnSchemaBuilder($type, $length);
21-
}
22-
23-
public function typesProvider(): array
24-
{
25-
return [
26-
['integer UNSIGNED', Schema::TYPE_INTEGER, null, [
27-
['unsigned'],
28-
]],
29-
['integer(10) UNSIGNED', Schema::TYPE_INTEGER, 10, [
30-
['unsigned'],
31-
]],
32-
['integer(10)', Schema::TYPE_INTEGER, 10, [
33-
['comment', 'test'],
34-
]],
35-
];
36-
}
17+
use TestTrait;
3718

3819
/**
39-
* @dataProvider typesProvider
20+
* @dataProvider \Yiisoft\Db\Sqlite\Tests\Provider\ColumnSchemaBuilderProvider::types();
4021
*/
41-
public function testCustomTypes(string $expected, string $type, ?int $length, mixed $calls): void
22+
public function testCustomTypes(string $expected, string $type, int|null $length, array $calls): void
4223
{
4324
$this->checkBuildString($expected, $type, $length, $calls);
4425
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Yiisoft\Db\Sqlite\Tests\Provider;
6+
7+
use Yiisoft\Db\Schema\Schema;
8+
use Yiisoft\Db\Tests\Provider\AbstractColumnSchemaBuilderProvider;
9+
10+
final class ColumnSchemaBuilderProvider extends AbstractColumnSchemaBuilderProvider
11+
{
12+
public function types(): array
13+
{
14+
$types = parent::types();
15+
16+
$types[0][0] = 'integer UNSIGNED NULL DEFAULT NULL';
17+
$types[1][0] = 'integer(10) UNSIGNED';
18+
19+
return array_merge(
20+
$types,
21+
[
22+
['integer UNSIGNED', Schema::TYPE_INTEGER, null, [['unsigned']]],
23+
],
24+
);
25+
}
26+
}

0 commit comments

Comments
 (0)