From c5fc475c62657b4b199d60e2f7c297f80b7ed4c7 Mon Sep 17 00:00:00 2001 From: Mior Muhammad Zaki Date: Sat, 19 Aug 2023 20:31:49 +0800 Subject: [PATCH] wip Signed-off-by: Mior Muhammad Zaki --- composer.json | 14 +++++++++----- src/Presets/Preset.php | 18 +++++++++++++++++- tests/Feature/CommandsProviderTest.php | 2 +- tests/Unit/Presets/LaravelTest.php | 2 +- tests/Unit/Presets/PackageTest.php | 2 +- 5 files changed, 29 insertions(+), 9 deletions(-) diff --git a/composer.json b/composer.json index 7edb556..feff2be 100644 --- a/composer.json +++ b/composer.json @@ -53,15 +53,19 @@ } }, "scripts": { - "post-autoload-dump": "@composer run prepare", + "post-autoload-dump": "@prepare", "prepare": "@php ./vendor/bin/testbench package:discover --ansi", - "ci": [ - "@composer audit", - "@composer run prepare", + "lint": [ "@php vendor/bin/phpstan analyse", "@php vendor/bin/pint" ], - "test": "@php vendor/bin/phpunit -c ./ --color" + "test": "@php vendor/bin/phpunit -c ./ --color", + "ci": [ + "@composer audit", + "@prepare", + "@lint", + "@test" + ] }, "prefer-stable": true, "minimum-stability": "dev" diff --git a/src/Presets/Preset.php b/src/Presets/Preset.php index 29c9c3d..eb95853 100644 --- a/src/Presets/Preset.php +++ b/src/Presets/Preset.php @@ -111,10 +111,26 @@ public function seederPath(): string return sprintf( '%s/%s', $this->basePath(), - $this->config('seeder.path', 'database/seeds') + $this->config('seeder.path', 'database/seeders') ); } + /** + * Databases namespace. + */ + public function databaseFactoryNamespace(): string + { + return $this->config('factory.namespace', 'Database\Factories\\'); + } + + /** + * Databases namespace. + */ + public function databaseSeederNamespace(): string + { + return $this->config('seeder.path', 'Database\Factories\\'); + } + /** * Sync commands to preset. */ diff --git a/tests/Feature/CommandsProviderTest.php b/tests/Feature/CommandsProviderTest.php index e96d1b2..3f9c2b6 100644 --- a/tests/Feature/CommandsProviderTest.php +++ b/tests/Feature/CommandsProviderTest.php @@ -29,6 +29,6 @@ public function it_can_setup_laravel_preset() $this->assertSame("{$directory}/resources", $preset->resourcePath()); $this->assertSame("{$directory}/database/factories", $preset->factoryPath()); $this->assertSame("{$directory}/database/migrations", $preset->migrationPath()); - $this->assertSame("{$directory}/database/seeds", $preset->seederPath()); + $this->assertSame("{$directory}/database/seeders", $preset->seederPath()); } } diff --git a/tests/Unit/Presets/LaravelTest.php b/tests/Unit/Presets/LaravelTest.php index 1da5902..df5bf76 100644 --- a/tests/Unit/Presets/LaravelTest.php +++ b/tests/Unit/Presets/LaravelTest.php @@ -31,7 +31,7 @@ public function it_has_proper_signatures() $this->assertSame("{$directory}/resources", $preset->resourcePath()); $this->assertSame("{$directory}/database/factories", $preset->factoryPath()); $this->assertSame("{$directory}/database/migrations", $preset->migrationPath()); - $this->assertSame("{$directory}/database/seeds", $preset->seederPath()); + $this->assertSame("{$directory}/database/seeders", $preset->seederPath()); $this->assertFalse($preset->hasCustomStubPath()); $this->assertNull($preset->getCustomStubPath()); diff --git a/tests/Unit/Presets/PackageTest.php b/tests/Unit/Presets/PackageTest.php index b91a574..963b22d 100644 --- a/tests/Unit/Presets/PackageTest.php +++ b/tests/Unit/Presets/PackageTest.php @@ -31,7 +31,7 @@ public function it_has_proper_signatures() $this->assertSame("{$directory}/resources", $preset->resourcePath()); $this->assertSame("{$directory}/database/factories", $preset->factoryPath()); $this->assertSame("{$directory}/database/migrations", $preset->migrationPath()); - $this->assertSame("{$directory}/database/seeds", $preset->seederPath()); + $this->assertSame("{$directory}/database/seeders", $preset->seederPath()); $this->assertFalse($preset->hasCustomStubPath()); $this->assertNull($preset->getCustomStubPath());