Skip to content

Commit 62022ac

Browse files
Added test coverage for Snowflakes
1 parent f165c5e commit 62022ac

File tree

1 file changed

+86
-0
lines changed

1 file changed

+86
-0
lines changed

tests/Database/Functional/Driver/Common/Schema/ConsistencyTest.php

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,92 @@ public function testTime(): void
360360
$this->assertTrue($schema->column('target')->compare($column));
361361
}
362362

363+
public function testSnowflake(): void
364+
{
365+
$schema = $this->schema('table');
366+
$this->assertFalse($schema->exists());
367+
368+
$column = $schema->snowflake('target');
369+
370+
$schema->save();
371+
372+
$schema = $this->schema('table');
373+
$this->assertTrue($schema->exists());
374+
$this->assertTrue($schema->column('target')->compare($column));
375+
$this->assertSame('int', $schema->column('target')->getType());
376+
377+
$this->database->table('table')->insertOne(
378+
[
379+
'target' => 7340580095540599922,
380+
],
381+
);
382+
383+
$this->assertEquals(
384+
[
385+
'target' => 7340580095540599922,
386+
],
387+
$this->database->table('table')->select()->fetchAll()[0],
388+
);
389+
}
390+
391+
public function testSnowflakeCallingColumnMethod(): void
392+
{
393+
$schema = $this->schema('table');
394+
$this->assertFalse($schema->exists());
395+
396+
$column = $schema->column('target')->snowflake();
397+
398+
$schema->save();
399+
400+
$schema = $this->schema('table');
401+
$this->assertTrue($schema->exists());
402+
$this->assertTrue($schema->column('target')->compare($column));
403+
$this->assertSame('int', $schema->column('target')->getType());
404+
405+
$this->database->table('table')->insertOne(
406+
[
407+
'target' => 7340580095540599922,
408+
],
409+
);
410+
411+
$this->assertEquals(
412+
[
413+
'target' => 7340580095540599922,
414+
],
415+
$this->database->table('table')->select()->fetchAll()[0],
416+
);
417+
}
418+
419+
public function testSnowflakePrimary(): void
420+
{
421+
$schema = $this->schema('table');
422+
$this->assertFalse($schema->exists());
423+
424+
$column = $schema->snowflake('target')->nullable(false);
425+
$schema->setPrimaryKeys(['target']);
426+
$schema->save();
427+
428+
$schema = $this->schema('table');
429+
$this->assertTrue($schema->exists());
430+
431+
$this->assertTrue($schema->column('target')->compare($column));
432+
$this->assertSame('int', $schema->column('target')->getType());
433+
$this->assertSame(['target'], $schema->getPrimaryKeys());
434+
435+
$this->database->table('table')->insertOne(
436+
[
437+
'target' => 7340580095540599922,
438+
],
439+
);
440+
441+
$this->assertEquals(
442+
[
443+
'target' => 7340580095540599922,
444+
],
445+
$this->database->table('table')->select()->fetchAll()[0],
446+
);
447+
}
448+
363449
public function testUlid(): void
364450
{
365451
$schema = $this->schema('table');

0 commit comments

Comments
 (0)