Skip to content

Commit b3d4a6f

Browse files
committed
CT-1526 - fix php-datatypes tests
1 parent 528c5ac commit b3d4a6f

1 file changed

Lines changed: 23 additions & 2 deletions

File tree

tests/SnowflakeDatatypeTest.php

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ public function testInvalidBinaryLengths($length): void
268268
public function testBasetypes(): void
269269
{
270270
foreach (Snowflake::TYPES as $type) {
271-
$basetype = (new Snowflake($type))->getBasetype();
271+
$basetype = (new Snowflake($type, $this->getTypeDefaultOptions($type)))->getBasetype();
272272
switch ($type) {
273273
case 'INT':
274274
case 'INTEGER':
@@ -484,7 +484,8 @@ public function testArrayFromLength(string $type, ?string $length, array $expect
484484
*/
485485
public function testBackendBasetypeFromAlias(string $type, string $expectedType): void
486486
{
487-
$definition = new Snowflake($type);
487+
488+
$definition = new Snowflake($type, $this->getTypeDefaultOptions($type));
488489
$this->assertSame($expectedType, $definition->getBackendBasetype());
489490
}
490491

@@ -569,4 +570,24 @@ public function provideTestGetTypeFromAlias(): Generator
569570
];
570571
}
571572
}
573+
574+
/**
575+
* @return array{
576+
* length?:string|null|array,
577+
* nullable?:bool,
578+
* default?:string|null
579+
* }
580+
*/
581+
private function getTypeDefaultOptions(string $type): array
582+
{
583+
$options = [];
584+
if ($type === Snowflake::TYPE_VECTOR) {
585+
// VECTOR don't have any meaningfully default option
586+
$options = [
587+
'length' => 'INT,3',
588+
];
589+
}
590+
591+
return $options;
592+
}
572593
}

0 commit comments

Comments
 (0)