From 86e113f2c774d16674ccfb06296a3f7f31820797 Mon Sep 17 00:00:00 2001 From: Luca Patera Date: Sat, 23 Sep 2023 16:32:11 +0200 Subject: [PATCH] Add MakeExceptionCommand for API exceptions --- src/Console/MakeExceptionCommand.php | 28 ++++++++++++++++++++++++++++ src/NutgramServiceProvider.php | 1 + src/Stubs/Exception.stub | 12 ++++++++++++ tests/Commands/MakeExceptionTest.php | 19 +++++++++++++++++++ 4 files changed, 60 insertions(+) create mode 100644 src/Console/MakeExceptionCommand.php create mode 100644 src/Stubs/Exception.stub create mode 100644 tests/Commands/MakeExceptionTest.php diff --git a/src/Console/MakeExceptionCommand.php b/src/Console/MakeExceptionCommand.php new file mode 100644 index 0000000..520d321 --- /dev/null +++ b/src/Console/MakeExceptionCommand.php @@ -0,0 +1,28 @@ +artisan(MakeExceptionCommand::class, ['name' => 'MyException']) + ->expectsOutput('Nutgram Exception created successfully.') + ->assertSuccessful(); + + expect(config('nutgram.namespace').'/Exceptions/MyException.php') + ->toBeFile() + ->getFileContent() + ->toContain('class MyException'); +});