Skip to content

Commit 305d9a6

Browse files
committed
tests added.
1 parent b72e576 commit 305d9a6

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

tests/Integration/Service/Generator/MigrationGeneratorTest.php

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,31 @@ public function setUp(): void
2020
);
2121
}
2222

23+
24+
public function testMakeGeneratorWithoutConnectionNameThrowsException(): void
25+
{
26+
$this->expectException(\InvalidArgumentException::class);
27+
$this->expectExceptionMessage('missing key connectionName in params.');
28+
$this->app->make(
29+
MigrationGeneratorInterface::class
30+
);
31+
}
32+
2333
public function testGenerateMigrationForTable(): void
2434
{
25-
$path = $this->resourceFolder . 'ExpectedMigrations/';
35+
$path = $this->resourceFolder.'ExpectedMigrations/';
2636
$this->generator->setMigrationDir($path);
2737
$result = $this->generator->generateMigrationForTable('testing', 'fields_test');
2838
$this->assertTrue($result);
2939
$files = $this->generator->getMigrationFiles();
3040
foreach ($files as $file) {
31-
$this->assertFileExists($path . DIRECTORY_SEPARATOR . $file);
41+
$this->assertFileExists($path.DIRECTORY_SEPARATOR.$file);
3242
}
3343
}
3444

3545
public function testGenerateMigrationForTableWithUnknownTableReturnsFalse(): void
3646
{
37-
$path = $this->resourceFolder . 'ExpectedMigrations/';
47+
$path = $this->resourceFolder.'ExpectedMigrations/';
3848
$this->generator->setMigrationDir($path);
3949
$result = $this->generator->generateMigrationForTable('testing', uniqid('test', true));
4050
$this->assertFalse($result);
@@ -43,7 +53,7 @@ public function testGenerateMigrationForTableWithUnknownTableReturnsFalse(): voi
4353

4454
public function tearDown(): void
4555
{
46-
$files = glob($this->resourceFolder . 'ExpectedMigrations/*');
56+
$files = glob($this->resourceFolder.'ExpectedMigrations/*');
4757
foreach ($files as $file) {
4858
if (is_file($file)) {
4959
unlink($file);

0 commit comments

Comments
 (0)