From 8fb2a68f3a19430f50634d851e2c7ce0451fa0f4 Mon Sep 17 00:00:00 2001 From: Mo Khosh Date: Tue, 1 Oct 2024 16:34:43 +0330 Subject: [PATCH] add tests for custom stub generation --- tests/Tests/KanbanBoardTest.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/Tests/KanbanBoardTest.php b/tests/Tests/KanbanBoardTest.php index 5760961..73ebe6e 100644 --- a/tests/Tests/KanbanBoardTest.php +++ b/tests/Tests/KanbanBoardTest.php @@ -20,6 +20,21 @@ ->toContainAsFile('class TestBoard extends KanbanBoard'); }); +it('can make kanban board from custom stub', function () { + File::delete($this->app->basePath('app/Filament/Pages/TestBoard.php')); + File::delete($this->app->basePath('stubs/filament-kanban/board.stub')); + File::ensureDirectoryExists($this->app->basePath('/stubs/filament-kanban/')); + File::put($this->app->basePath('/stubs/filament-kanban/board.stub'), 'custom stub'); + + $pagesPath = $this->app->basePath('app/Filament/Pages'); + + $this->artisan('make:kanban TestBoard')->assertExitCode(0); + + expect($pagesPath . '/TestBoard.php') + ->toBeFile() + ->toContainAsFile('custom stub'); +}); + it('loads statuses', function () { $statuses = TaskStatus::statuses() ->pluck('title')