Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/Console/Commands/MakeModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int

File::put($filePath, $stub);

$output->writeln(["<info>{$this->commonName()} successfully generated!</info>", self::EMPTY_LINE]);
$outputPath = str_replace(base_path(), '', $filePath);

$output->writeln(["<info>{$this->commonName()} [{$outputPath}] successfully generated!</info>", self::EMPTY_LINE]);

return parent::SUCCESS;
}
Expand Down
4 changes: 3 additions & 1 deletion src/Console/Maker.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int

File::put($filePath, $stub);

$output->writeln(["<info>{$this->commonName()} successfully generated!</info>", self::EMPTY_LINE]);
$outputPath = str_replace(base_path(), '', $filePath);

$output->writeln(["<info>{$this->commonName()} [{$outputPath}] successfully generated!</info>", self::EMPTY_LINE]);

return Command::SUCCESS;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Database/Console/MakeSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/stubs/controller.stub
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
10 changes: 5 additions & 5 deletions tests/Unit/Console/MakeCollectionCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down Expand Up @@ -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));
});

Expand All @@ -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!');
});
8 changes: 4 additions & 4 deletions tests/Unit/Console/MakeControllerCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down Expand Up @@ -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));
});

Expand All @@ -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 () {
Expand All @@ -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!');
});
6 changes: 3 additions & 3 deletions tests/Unit/Console/MakeMiddlewareCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down Expand Up @@ -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));
});

Expand All @@ -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!');
});
29 changes: 15 additions & 14 deletions tests/Unit/Console/MakeModelCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down Expand Up @@ -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));
});

Expand All @@ -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 () {
Expand Down Expand Up @@ -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 () {
Expand Down Expand Up @@ -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 () {
Expand Down Expand Up @@ -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 () {
Expand Down Expand Up @@ -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 () {
Expand Down Expand Up @@ -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!');
});
6 changes: 3 additions & 3 deletions tests/Unit/Console/MakeQueryCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down Expand Up @@ -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));
});

Expand All @@ -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!');
});
6 changes: 3 additions & 3 deletions tests/Unit/Console/MakeRequestCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down Expand Up @@ -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));
});

Expand All @@ -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!');
});
2 changes: 1 addition & 1 deletion tests/Unit/Console/MakeServiceProviderCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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!');
});
8 changes: 4 additions & 4 deletions tests/Unit/Console/MakeTestCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down Expand Up @@ -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));
});

Expand All @@ -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 () {
Expand All @@ -129,5 +129,5 @@

$command->assertCommandIsSuccessful();

expect($command->getDisplay())->toContain('Test successfully generated!');
expect($command->getDisplay())->toContain('Test [tests/Unit/ExampleTest.php] successfully generated!');
});
3 changes: 2 additions & 1 deletion tests/Unit/Database/Console/MakeMigrationCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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!');
});
2 changes: 1 addition & 1 deletion tests/Unit/Database/Console/MakeSeederCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@

$command->assertCommandIsSuccessful();

expect($command->getDisplay())->toContain('Seeder successfully generated!');
expect($command->getDisplay())->toContain('Seeder [database/seeders/UsersSeeder.php] successfully generated!');
});
2 changes: 1 addition & 1 deletion tests/Unit/Queue/Console/TableCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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!');
});
8 changes: 4 additions & 4 deletions tests/Unit/Tasks/Console/MakeTaskCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand All @@ -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 () {
Expand Down Expand Up @@ -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));
});

Expand All @@ -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!');
});