diff --git a/src/Console/Commands/MakeModel.php b/src/Console/Commands/MakeModel.php index 069377b6..3ff88f0d 100644 --- a/src/Console/Commands/MakeModel.php +++ b/src/Console/Commands/MakeModel.php @@ -102,7 +102,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int File::put($filePath, $stub); - $output->writeln(["{$this->commonName()} successfully generated!", self::EMPTY_LINE]); + $outputPath = str_replace(base_path(), '', $filePath); + + $output->writeln(["{$this->commonName()} [{$outputPath}] successfully generated!", self::EMPTY_LINE]); return parent::SUCCESS; } diff --git a/src/Console/Maker.php b/src/Console/Maker.php index 14a90479..b9d8b03e 100644 --- a/src/Console/Maker.php +++ b/src/Console/Maker.php @@ -48,7 +48,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int File::put($filePath, $stub); - $output->writeln(["{$this->commonName()} successfully generated!", self::EMPTY_LINE]); + $outputPath = str_replace(base_path(), '', $filePath); + + $output->writeln(["{$this->commonName()} [{$outputPath}] successfully generated!", self::EMPTY_LINE]); return Command::SUCCESS; } diff --git a/src/Database/Console/MakeSeeder.php b/src/Database/Console/MakeSeeder.php index 89b603a2..990e38f2 100644 --- a/src/Database/Console/MakeSeeder.php +++ b/src/Database/Console/MakeSeeder.php @@ -36,7 +36,7 @@ protected function configure(): void protected function outputDirectory(): string { - return 'database' . DIRECTORY_SEPARATOR . 'seeds'; + return 'database' . DIRECTORY_SEPARATOR . 'seeders'; } protected function stub(): string diff --git a/src/stubs/controller.stub b/src/stubs/controller.stub index fca5395a..2d455916 100644 --- a/src/stubs/controller.stub +++ b/src/stubs/controller.stub @@ -4,10 +4,10 @@ declare(strict_types=1); namespace {namespace}; +use Phenix\Http\Constants\HttpStatus; +use Phenix\Http\Controller; use Phenix\Http\Request; use Phenix\Http\Response; -use Amp\Http\Status; -use Phenix\Http\Controller; class {name} extends Controller { diff --git a/tests/Unit/Console/MakeCollectionCommandTest.php b/tests/Unit/Console/MakeCollectionCommandTest.php index c3dfdf5c..358a0ce9 100644 --- a/tests/Unit/Console/MakeCollectionCommandTest.php +++ b/tests/Unit/Console/MakeCollectionCommandTest.php @@ -22,12 +22,12 @@ /** @var CommandTester $command */ $command = $this->phenix('make:collection', [ - 'name' => 'User', + 'name' => 'UserCollection', ]); $command->assertCommandIsSuccessful(); - expect($command->getDisplay())->toContain('Collection successfully generated!'); + expect($command->getDisplay())->toContain('Collection [app/Collections/UserCollection.php] successfully generated!'); }); it('does not create the collection because it already exists', function () { @@ -72,13 +72,13 @@ /** @var CommandTester $command */ $command = $this->phenix('make:collection', [ - 'name' => 'User', + 'name' => 'UserCollection', '--force' => true, ]); $command->assertCommandIsSuccessful(); - expect($command->getDisplay())->toContain('Collection successfully generated!'); + expect($command->getDisplay())->toContain('Collection [app/Collections/UserCollection.php] successfully generated!'); expect('new content')->toBe(file_get_contents($tempPath)); }); @@ -101,5 +101,5 @@ $command->assertCommandIsSuccessful(); - expect($command->getDisplay())->toContain('Collection successfully generated!'); + expect($command->getDisplay())->toContain('Collection [app/Collections/Admin/User.php] successfully generated!'); }); diff --git a/tests/Unit/Console/MakeControllerCommandTest.php b/tests/Unit/Console/MakeControllerCommandTest.php index ed86ae8c..e2ed621f 100644 --- a/tests/Unit/Console/MakeControllerCommandTest.php +++ b/tests/Unit/Console/MakeControllerCommandTest.php @@ -24,7 +24,7 @@ $command->assertCommandIsSuccessful(); - expect($command->getDisplay())->toContain('Controller successfully generated!'); + expect($command->getDisplay())->toContain('Controller [app/Http/Controllers/TestController.php] successfully generated!'); }); it('does not create the controller because it already exists', function () { @@ -75,7 +75,7 @@ $command->assertCommandIsSuccessful(); - expect($command->getDisplay())->toContain('Controller successfully generated!'); + expect($command->getDisplay())->toContain('Controller [app/Http/Controllers/TestController.php] successfully generated!'); expect('new content')->toBe(file_get_contents($tempPath)); }); @@ -98,7 +98,7 @@ $command->assertCommandIsSuccessful(); - expect($command->getDisplay())->toContain('Controller successfully generated!'); + expect($command->getDisplay())->toContain('Controller [app/Http/Controllers/Admin/UserController.php] successfully generated!'); }); it('creates controller successfully with api option', function () { @@ -124,6 +124,6 @@ $command->assertCommandIsSuccessful(); - expect($command->getDisplay())->toContain('Controller successfully generated!'); + expect($command->getDisplay())->toContain('Controller [app/Http/Controllers/TestController.php] successfully generated!'); expect(file_get_contents($tempPath))->toContain('Hello, world!'); }); diff --git a/tests/Unit/Console/MakeMiddlewareCommandTest.php b/tests/Unit/Console/MakeMiddlewareCommandTest.php index bed1025d..8e9345a8 100644 --- a/tests/Unit/Console/MakeMiddlewareCommandTest.php +++ b/tests/Unit/Console/MakeMiddlewareCommandTest.php @@ -28,7 +28,7 @@ $command->assertCommandIsSuccessful(); - expect($command->getDisplay())->toContain('Middleware successfully generated!'); + expect($command->getDisplay())->toContain('Middleware [app/Http/Middleware/AwesomeMiddleware.php] successfully generated!'); }); it('does not create the middleware because it already exists', function () { @@ -79,7 +79,7 @@ $command->assertCommandIsSuccessful(); - expect($command->getDisplay())->toContain('Middleware successfully generated!'); + expect($command->getDisplay())->toContain('Middleware [app/Http/Middleware/TestMiddleware.php] successfully generated!'); expect('new content')->toBe(file_get_contents($tempPath)); }); @@ -106,5 +106,5 @@ $command->assertCommandIsSuccessful(); - expect($command->getDisplay())->toContain('Middleware successfully generated!'); + expect($command->getDisplay())->toContain('Middleware [app/Http/Middleware/Admin/TestMiddleware.php] successfully generated!'); }); diff --git a/tests/Unit/Console/MakeModelCommandTest.php b/tests/Unit/Console/MakeModelCommandTest.php index 26981e4b..1bde3f09 100644 --- a/tests/Unit/Console/MakeModelCommandTest.php +++ b/tests/Unit/Console/MakeModelCommandTest.php @@ -27,7 +27,7 @@ $command->assertCommandIsSuccessful(); - expect($command->getDisplay())->toContain('Model successfully generated!'); + expect($command->getDisplay())->toContain('Model [app/Models/User.php] successfully generated!'); }); it('does not create the model because it already exists', function () { @@ -78,7 +78,7 @@ $command->assertCommandIsSuccessful(); - expect($command->getDisplay())->toContain('Model successfully generated!'); + expect($command->getDisplay())->toContain('Model [app/Models/User.php] successfully generated!'); expect('new content')->toBe(file_get_contents($tempPath)); }); @@ -101,7 +101,7 @@ $command->assertCommandIsSuccessful(); - expect($command->getDisplay())->toContain('Model successfully generated!'); + expect($command->getDisplay())->toContain('Model [app/Models/Admin/User.php] successfully generated!'); }); it('creates model with custom collection', function () { @@ -139,8 +139,8 @@ $command->assertCommandIsSuccessful(); - expect($command->getDisplay())->toContain('Model successfully generated!'); - expect($command->getDisplay())->toContain('Collection successfully generated!'); + expect($command->getDisplay())->toContain('Model [app/Models/User.php] successfully generated!'); + expect($command->getDisplay())->toContain('Collection [app/Collections/UserCollection.php] successfully generated!'); }); it('creates model with custom query builder', function () { @@ -178,8 +178,8 @@ $command->assertCommandIsSuccessful(); - expect($command->getDisplay())->toContain('Model successfully generated!'); - expect($command->getDisplay())->toContain('Query successfully generated!'); + expect($command->getDisplay())->toContain('Model [app/Models/User.php] successfully generated!'); + expect($command->getDisplay())->toContain('Query [app/Queries/UserQuery.php] successfully generated!'); }); it('creates model with all', function () { @@ -223,9 +223,9 @@ $command->assertCommandIsSuccessful(); - expect($command->getDisplay())->toContain('Model successfully generated!'); - expect($command->getDisplay())->toContain('Query successfully generated!'); - expect($command->getDisplay())->toContain('Collection successfully generated!'); + expect($command->getDisplay())->toContain('Model [app/Models/User.php] successfully generated!'); + expect($command->getDisplay())->toContain('Query [app/Queries/UserQuery.php] successfully generated!'); + expect($command->getDisplay())->toContain('Collection [app/Collections/UserCollection.php] successfully generated!'); }); it('creates model with migration', function () { @@ -261,8 +261,9 @@ $command->assertCommandIsSuccessful(); - expect($command->getDisplay())->toContain('Model successfully generated!'); - expect($command->getDisplay())->toContain('Migration successfully generated!'); + expect($command->getDisplay())->toContain('Model [app/Models/User.php] successfully generated!'); + expect($command->getDisplay())->toContain('Migration [database/migrations/'); + expect($command->getDisplay())->toContain('_create_users_table.php] successfully generated!'); }); it('creates model with controller', function () { @@ -298,6 +299,6 @@ $command->assertCommandIsSuccessful(); - expect($command->getDisplay())->toContain('Model successfully generated!'); - expect($command->getDisplay())->toContain('Controller successfully generated!'); + expect($command->getDisplay())->toContain('Model [app/Models/User.php] successfully generated!'); + expect($command->getDisplay())->toContain('Controller [app/Http/Controllers/UserController.php] successfully generated!'); }); diff --git a/tests/Unit/Console/MakeQueryCommandTest.php b/tests/Unit/Console/MakeQueryCommandTest.php index 16b4399c..4ca9ba42 100644 --- a/tests/Unit/Console/MakeQueryCommandTest.php +++ b/tests/Unit/Console/MakeQueryCommandTest.php @@ -27,7 +27,7 @@ $command->assertCommandIsSuccessful(); - expect($command->getDisplay())->toContain('Query successfully generated!'); + expect($command->getDisplay())->toContain('Query [app/Queries/UserQuery.php] successfully generated!'); }); it('does not create the query because it already exists', function () { @@ -78,7 +78,7 @@ $command->assertCommandIsSuccessful(); - expect($command->getDisplay())->toContain('Query successfully generated!'); + expect($command->getDisplay())->toContain('Query [app/Queries/UserQuery.php] successfully generated!'); expect('new content')->toBe(file_get_contents($tempPath)); }); @@ -101,5 +101,5 @@ $command->assertCommandIsSuccessful(); - expect($command->getDisplay())->toContain('Query successfully generated!'); + expect($command->getDisplay())->toContain('Query [app/Queries/Domain/UserQuery.php] successfully generated!'); }); diff --git a/tests/Unit/Console/MakeRequestCommandTest.php b/tests/Unit/Console/MakeRequestCommandTest.php index 9e41f65a..27faaeab 100644 --- a/tests/Unit/Console/MakeRequestCommandTest.php +++ b/tests/Unit/Console/MakeRequestCommandTest.php @@ -28,7 +28,7 @@ $command->assertCommandIsSuccessful(); - expect($command->getDisplay())->toContain('Request successfully generated!'); + expect($command->getDisplay())->toContain('Request [app/Http/Requests/StoreUserRequest.php] successfully generated!'); }); it('does not create the form request because it already exists', function () { @@ -79,7 +79,7 @@ $command->assertCommandIsSuccessful(); - expect($command->getDisplay())->toContain('Request successfully generated!'); + expect($command->getDisplay())->toContain('Request [app/Http/Requests/StoreUserRequest.php] successfully generated!'); expect('new content')->toBe(file_get_contents($tempPath)); }); @@ -106,5 +106,5 @@ $command->assertCommandIsSuccessful(); - expect($command->getDisplay())->toContain('Request successfully generated!'); + expect($command->getDisplay())->toContain('Request [app/Http/Requests/Admin/StoreUserRequest.php] successfully generated!'); }); diff --git a/tests/Unit/Console/MakeServiceProviderCommandTest.php b/tests/Unit/Console/MakeServiceProviderCommandTest.php index d21cf691..e2583a27 100644 --- a/tests/Unit/Console/MakeServiceProviderCommandTest.php +++ b/tests/Unit/Console/MakeServiceProviderCommandTest.php @@ -28,5 +28,5 @@ $command->assertCommandIsSuccessful(); - expect($command->getDisplay())->toContain('Service provider successfully generated!'); + expect($command->getDisplay())->toContain('Service provider [app/Providers/SlackServiceProvider.php] successfully generated!'); }); diff --git a/tests/Unit/Console/MakeTestCommandTest.php b/tests/Unit/Console/MakeTestCommandTest.php index b79fcdef..f218e0af 100644 --- a/tests/Unit/Console/MakeTestCommandTest.php +++ b/tests/Unit/Console/MakeTestCommandTest.php @@ -28,7 +28,7 @@ $command->assertCommandIsSuccessful(); - expect($command->getDisplay())->toContain('Test successfully generated!'); + expect($command->getDisplay())->toContain('Test [tests/Feature/ExampleTest.php] successfully generated!'); }); it('does not create the test because it already exists', function () { @@ -79,7 +79,7 @@ $command->assertCommandIsSuccessful(); - expect($command->getDisplay())->toContain('Test successfully generated!'); + expect($command->getDisplay())->toContain('Test [tests/Feature/ExampleTest.php] successfully generated!'); expect('new content')->toBe(file_get_contents($tempPath)); }); @@ -102,7 +102,7 @@ $command->assertCommandIsSuccessful(); - expect($command->getDisplay())->toContain('Test successfully generated!'); + expect($command->getDisplay())->toContain('Test [tests/Feature/Admin/ExampleTest.php] successfully generated!'); }); it('creates test successfully with unit option', function () { @@ -129,5 +129,5 @@ $command->assertCommandIsSuccessful(); - expect($command->getDisplay())->toContain('Test successfully generated!'); + expect($command->getDisplay())->toContain('Test [tests/Unit/ExampleTest.php] successfully generated!'); }); diff --git a/tests/Unit/Database/Console/MakeMigrationCommandTest.php b/tests/Unit/Database/Console/MakeMigrationCommandTest.php index 9907938b..2eb89fd4 100644 --- a/tests/Unit/Database/Console/MakeMigrationCommandTest.php +++ b/tests/Unit/Database/Console/MakeMigrationCommandTest.php @@ -24,5 +24,6 @@ $command->assertCommandIsSuccessful(); - expect($command->getDisplay())->toContain('Migration successfully generated!'); + expect($command->getDisplay())->toContain('Migration [database/migrations/'); + expect($command->getDisplay())->toContain('_create_products_table.php] successfully generated!'); }); diff --git a/tests/Unit/Database/Console/MakeSeederCommandTest.php b/tests/Unit/Database/Console/MakeSeederCommandTest.php index 4784fedb..a4152f5e 100644 --- a/tests/Unit/Database/Console/MakeSeederCommandTest.php +++ b/tests/Unit/Database/Console/MakeSeederCommandTest.php @@ -24,5 +24,5 @@ $command->assertCommandIsSuccessful(); - expect($command->getDisplay())->toContain('Seeder successfully generated!'); + expect($command->getDisplay())->toContain('Seeder [database/seeders/UsersSeeder.php] successfully generated!'); }); diff --git a/tests/Unit/Queue/Console/TableCommandTest.php b/tests/Unit/Queue/Console/TableCommandTest.php index 89b679b1..f05f15cf 100644 --- a/tests/Unit/Queue/Console/TableCommandTest.php +++ b/tests/Unit/Queue/Console/TableCommandTest.php @@ -27,5 +27,5 @@ $command->assertCommandIsSuccessful(); - expect($command->getDisplay())->toContain('Queue table successfully generated!'); + expect($command->getDisplay())->toContain('Queue table [database/migrations/20250101205638_create_tasks_table.php] successfully generated!'); }); diff --git a/tests/Unit/Tasks/Console/MakeTaskCommandTest.php b/tests/Unit/Tasks/Console/MakeTaskCommandTest.php index 23778d18..6fa74ded 100644 --- a/tests/Unit/Tasks/Console/MakeTaskCommandTest.php +++ b/tests/Unit/Tasks/Console/MakeTaskCommandTest.php @@ -28,7 +28,7 @@ $command->assertCommandIsSuccessful(); - expect($command->getDisplay())->toContain('Task successfully generated!'); + expect($command->getDisplay())->toContain('Task [app/Tasks/AwesomeTask.php] successfully generated!'); }); it('creates queuable task successfully', function () { @@ -55,7 +55,7 @@ $command->assertCommandIsSuccessful(); - expect($command->getDisplay())->toContain('Task successfully generated!'); + expect($command->getDisplay())->toContain('Task [app/Tasks/AwesomeTask.php] successfully generated!'); }); it('does not create the task because it already exists', function () { @@ -106,7 +106,7 @@ $command->assertCommandIsSuccessful(); - expect($command->getDisplay())->toContain('Task successfully generated!'); + expect($command->getDisplay())->toContain('Task [app/Tasks/TestTask.php] successfully generated!'); expect('new content')->toBe(file_get_contents($tempPath)); }); @@ -133,5 +133,5 @@ $command->assertCommandIsSuccessful(); - expect($command->getDisplay())->toContain('Task successfully generated!'); + expect($command->getDisplay())->toContain('Task [app/Tasks/Admin/TestTask.php] successfully generated!'); });