1010use PHPUnit \Framework \Attributes \DataProviderExternal ;
1111use Yiisoft \Db \Connection \ConnectionInterface ;
1212use Yiisoft \Db \Expression \Expression ;
13- use Yiisoft \Db \Schema \Column \ColumnBuilder ;
1413use Yiisoft \Db \Tests \AbstractColumnTest ;
1514use Yiisoft \Db \Tests \Provider \ColumnProvider ;
1615use Yiisoft \Db \Tests \Support \Stringable ;
@@ -27,8 +26,6 @@ abstract class CommonColumnTest extends AbstractColumnTest
2726
2827 protected const DATETIME_COLUMN_TABLE = 'datetime_column_test ' ;
2928
30- protected const COLUMN_BUILDER = ColumnBuilder::class;
31-
3229 abstract protected function insertTypeValues (ConnectionInterface $ db ): void ;
3330
3431 abstract protected function assertTypecastedValues (array $ result , bool $ allTypecasted = false ): void ;
@@ -119,22 +116,23 @@ public function createDateTimeColumnTable(ConnectionInterface $db): void
119116 {
120117 $ schema = $ db ->getSchema ();
121118 $ command = $ db ->createCommand ();
119+ $ columnBuilder = $ db ->getColumnBuilderClass ();
122120
123121 if ($ schema ->hasTable (static ::DATETIME_COLUMN_TABLE )) {
124122 $ command ->dropTable (static ::DATETIME_COLUMN_TABLE )->execute ();
125123 }
126124
127125 $ command ->createTable (static ::DATETIME_COLUMN_TABLE , [
128- 'timestamp ' => static :: COLUMN_BUILDER ::timestamp ()->defaultValue (new Expression ('CURRENT_TIMESTAMP ' )),
129- 'datetime ' => static :: COLUMN_BUILDER ::datetime ()->defaultValue ('2025-04-19 14:11:35 ' ),
130- 'datetime3 ' => static :: COLUMN_BUILDER ::datetime (3 )->defaultValue (new Stringable ('2025-04-19 14:11:35.123 ' )),
131- 'datetimetz ' => static :: COLUMN_BUILDER ::datetimeWithTimezone ()->defaultValue (new DateTime ('2025-04-19 14:11:35 +02:00 ' )),
132- 'datetimetz6 ' => static :: COLUMN_BUILDER ::datetimeWithTimezone (6 )->defaultValue (new DateTimeImmutable ('2025-04-19 14:11:35.123456 +02:00 ' )),
133- 'time ' => static :: COLUMN_BUILDER ::time ()->defaultValue ('14:11:35 ' ),
134- 'time3 ' => static :: COLUMN_BUILDER ::time (3 )->defaultValue (new Stringable ('14:11:35.123 ' )),
135- 'timetz ' => static :: COLUMN_BUILDER ::timeWithTimezone ()->defaultValue (new DateTime ('14:11:35 +02:00 ' )),
136- 'timetz6 ' => static :: COLUMN_BUILDER ::timeWithTimezone (6 )->defaultValue (new DateTimeImmutable ('14:11:35.123456 +02:00 ' )),
137- 'date ' => static :: COLUMN_BUILDER ::date ()->defaultValue ('2025-04-19 ' ),
126+ 'timestamp ' => $ columnBuilder ::timestamp ()->defaultValue (new Expression ('CURRENT_TIMESTAMP ' )),
127+ 'datetime ' => $ columnBuilder ::datetime ()->defaultValue ('2025-04-19 14:11:35 ' ),
128+ 'datetime3 ' => $ columnBuilder ::datetime (3 )->defaultValue (new Stringable ('2025-04-19 14:11:35.123 ' )),
129+ 'datetimetz ' => $ columnBuilder ::datetimeWithTimezone ()->defaultValue (new DateTime ('2025-04-19 14:11:35 +02:00 ' )),
130+ 'datetimetz6 ' => $ columnBuilder ::datetimeWithTimezone (6 )->defaultValue (new DateTimeImmutable ('2025-04-19 14:11:35.123456 +02:00 ' )),
131+ 'time ' => $ columnBuilder ::time ()->defaultValue ('14:11:35 ' ),
132+ 'time3 ' => $ columnBuilder ::time (3 )->defaultValue (new Stringable ('14:11:35.123 ' )),
133+ 'timetz ' => $ columnBuilder ::timeWithTimezone ()->defaultValue (new DateTime ('14:11:35 +02:00 ' )),
134+ 'timetz6 ' => $ columnBuilder ::timeWithTimezone (6 )->defaultValue (new DateTimeImmutable ('14:11:35.123456 +02:00 ' )),
135+ 'date ' => $ columnBuilder ::date ()->defaultValue ('2025-04-19 ' ),
138136 ])->execute ();
139137 }
140138
0 commit comments