Skip to content

Commit 5c21ad6

Browse files
committed
fix:test
1 parent 78c8cdb commit 5c21ad6

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

tests/MigrationGeneratorTest.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Illuminate\Support\Carbon;
66
use Illuminate\Support\Facades\Config;
7+
use RonasIT\Support\Events\WarningEvent;
78
use RonasIT\Support\Exceptions\UnknownFieldTypeException;
89
use RonasIT\Support\Generators\MigrationGenerator;
910

@@ -84,9 +85,9 @@ public function testCreateMigrationWithoutMigrationStub(): void
8485
{
8586
Carbon::setTestNow('2022-02-02');
8687

87-
Config::set('entity-generator.stubs.migration');
88+
config(['entity-generator.stubs.migration' => 'incorrect_stub']);
8889

89-
$result = app(MigrationGenerator::class)
90+
app(MigrationGenerator::class)
9091
->setModel('Post')
9192
->setRelations([
9293
'belongsTo' => [],
@@ -102,6 +103,11 @@ public function testCreateMigrationWithoutMigrationStub(): void
102103
])
103104
->generate();
104105

105-
$this->assertNull($result);
106+
$this->assertFileDoesNotExist('database/migrations/2022_02_02_000000_posts_create_table.php');
107+
108+
$this->assertEventPushed(
109+
className: WarningEvent::class,
110+
message: 'Generation of migration has been skipped cause the view incorrect_stub from the config entity-generator.stubs.migration is not exists. Please check that config has the correct view name value.',
111+
);
106112
}
107113
}

0 commit comments

Comments
 (0)