-
-
Notifications
You must be signed in to change notification settings - Fork 283
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
tests/Unit/Migration/Generator/ForeignKeyGeneratorTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace KitLoong\MigrationsGenerator\Tests\Unit\Migration\Generator; | ||
|
||
use KitLoong\MigrationsGenerator\Database\Models\SQLite\SQLiteForeignKey; | ||
use KitLoong\MigrationsGenerator\Enum\Migrations\Method\Foreign; | ||
use KitLoong\MigrationsGenerator\Migration\Generator\ForeignKeyGenerator; | ||
use KitLoong\MigrationsGenerator\Setting; | ||
use KitLoong\MigrationsGenerator\Tests\TestCase; | ||
|
||
class ForeignKeyGeneratorTest extends TestCase | ||
{ | ||
public function testGenerateDropWithNullName(): void | ||
{ | ||
$setting = app(Setting::class); | ||
$setting->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()); | ||
} | ||
} |