From ad96b89b3939ce7c3cb1175b86322ffb1f81f18a Mon Sep 17 00:00:00 2001 From: Kit Loong Date: Tue, 6 Aug 2024 23:01:17 +0800 Subject: [PATCH] Test foreign key with null name --- .../Generator/ForeignKeyGeneratorTest.php | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 tests/Unit/Migration/Generator/ForeignKeyGeneratorTest.php diff --git a/tests/Unit/Migration/Generator/ForeignKeyGeneratorTest.php b/tests/Unit/Migration/Generator/ForeignKeyGeneratorTest.php new file mode 100644 index 0000000..7fe7927 --- /dev/null +++ b/tests/Unit/Migration/Generator/ForeignKeyGeneratorTest.php @@ -0,0 +1,33 @@ +setIgnoreForeignKeyNames(false); + + $foreignKeyGenerator = app(ForeignKeyGenerator::class); + + $method = $foreignKeyGenerator->generateDrop(new SQLiteForeignKey('table', [ + 'name' => null, + 'columns' => ['column'], + 'foreign_schema' => null, + 'foreign_table' => 'foreign_table', + 'foreign_columns' => ['foreign_column'], + 'on_update' => 'on_update', + 'on_delete' => 'on_delete', + ])); + + $this->assertSame($method->getName(), Foreign::DROP_FOREIGN); + $this->assertEmpty($method->getValues()); + } +}