From dc5496aad176a2d0f667a8e96f7c82f2fb4fef42 Mon Sep 17 00:00:00 2001 From: Alexander Gaal Date: Mon, 22 Jan 2024 23:03:20 +0100 Subject: [PATCH] wip --- docs/_sidebar.md | 27 ++++++++++++++++++- .../action.md} | 4 +-- docs/commands/builder.md | 20 ++++++++++++++ docs/commands/collection.md | 21 +++++++++++++++ docs/commands/command.md | 21 +++++++++++++++ docs/commands/controller.md | 22 +++++++++++++++ docs/installation.md | 18 ++++--------- tests/DocumentationTest/ActionTest.php | 21 +++++++++++++++ tests/DocumentationTest/BuilderTest.php | 21 +++++++++++++++ tests/DocumentationTest/CollectionTest.php | 21 +++++++++++++++ tests/DocumentationTest/CommandTest.php | 21 +++++++++++++++ tests/DocumentationTest/ControllerTest.php | 21 +++++++++++++++ tests/DocumentationTest/DataObjectTest.php | 21 +++++++++++++++ tests/DocumentationTest/EnumTest.php | 21 +++++++++++++++ tests/DocumentationTest/EventTest.php | 21 +++++++++++++++ tests/DocumentationTest/JobTest.php | 21 +++++++++++++++ tests/DocumentationTest/ListenerTest.php | 21 +++++++++++++++ 17 files changed, 327 insertions(+), 16 deletions(-) rename docs/{make-action-command.md => commands/action.md} (90%) create mode 100644 docs/commands/builder.md create mode 100644 docs/commands/collection.md create mode 100644 docs/commands/command.md create mode 100644 docs/commands/controller.md create mode 100644 tests/DocumentationTest/ActionTest.php create mode 100644 tests/DocumentationTest/BuilderTest.php create mode 100644 tests/DocumentationTest/CollectionTest.php create mode 100644 tests/DocumentationTest/CommandTest.php create mode 100644 tests/DocumentationTest/ControllerTest.php create mode 100644 tests/DocumentationTest/DataObjectTest.php create mode 100644 tests/DocumentationTest/EnumTest.php create mode 100644 tests/DocumentationTest/EventTest.php create mode 100644 tests/DocumentationTest/JobTest.php create mode 100644 tests/DocumentationTest/ListenerTest.php diff --git a/docs/_sidebar.md b/docs/_sidebar.md index 792b4ed..d2646d7 100644 --- a/docs/_sidebar.md +++ b/docs/_sidebar.md @@ -1,5 +1,30 @@ * Getting Started * [Installation](installation.md) + * Structure * [Upgrade Guide](upgrade.md) + * Roadmap * Commands - * [MakeActionCommand](make-action-command.md) \ No newline at end of file + * [Action](commands/action.md) + * [Builder](commands/builder.md) + * [Collection](commands/collection.md) + * [Command](commands/command.md) + * [Controller](commands/controller.md) + * Data + * Enum + * Event + * Job + * Listener + * Middleware + * Migration + * Model + * Module + * Notification + * Observer + * Policy + * Process + * Query + * Request + * Resource + * Rule + * ServiceProvider + * Test diff --git a/docs/make-action-command.md b/docs/commands/action.md similarity index 90% rename from docs/make-action-command.md rename to docs/commands/action.md index 4b502e1..c7520ca 100644 --- a/docs/make-action-command.md +++ b/docs/commands/action.md @@ -1,4 +1,4 @@ -# MakeActionCommand +# Action Creates a new action class inside the given module. > Actions will be placed in `modules/{Module}/Domain/Actions` @@ -10,7 +10,7 @@ php artisan beyond:make:action User.CreateUserAction ``` ### Command -`beyond:make:action` +`beyond:make:action {name} {--force}` ### Flags | Name | Short | Description | Example | diff --git a/docs/commands/builder.md b/docs/commands/builder.md new file mode 100644 index 0000000..14dd367 --- /dev/null +++ b/docs/commands/builder.md @@ -0,0 +1,20 @@ +# Builder +Creates a new eloquent builder inside the given module. + +> Builders will be placed in `modules/{Module}/Domain/Builders` + +## Usage +```bash +php artisan beyond:make:builder User.Admin/UserAdminBuilder +php artisan beyond:make:builder User.UserBuilder +``` + +### Command +`beyond:make:builder {name} {--force}` + +### Flags +| Name | Short | Description | Example | +|---------|-------|--------------------------|---------| +| --force | | Overwrites existing file | | + + diff --git a/docs/commands/collection.md b/docs/commands/collection.md new file mode 100644 index 0000000..d251799 --- /dev/null +++ b/docs/commands/collection.md @@ -0,0 +1,21 @@ +# Collection +Creates a new collection inside the given module. + +> Collections will be placed in `modules/{Module}/Domain/Collections` + +## Usage +```bash +php artisan beyond:make:collection User.Admin/UserAdminCollection +php artisan beyond:make:collection User.UserCollection +``` + +### Command +`beyond:make:collection {name} {--model=} {--force}` + +### Flags +| Name | Short | Description | Example | +|---------|-------|----------------------------------|---------| +| --model | | Adds the model to the collection | User | +| --force | | Overwrites existing file | | + + diff --git a/docs/commands/command.md b/docs/commands/command.md new file mode 100644 index 0000000..26cc4cf --- /dev/null +++ b/docs/commands/command.md @@ -0,0 +1,21 @@ +# Command +Creates a new command inside the given module. + +> Commands will be placed in `modules/{Module}/App/Commands` + +## Usage +```bash +php artisan beyond:make:command User.Admin/SyncAdminCommand +php artisan beyond:make:command User.PurgeInactiveUsersCommand +``` + +### Command +`beyond:make:command {name} {--command=command:name} {--force}` + +### Flags +| Name | Short | Description | Example | +|-----------|-------|--------------------------|--------------| +| --command | | Defines the CLI command | command:name | +| --force | | Overwrites existing file | | + + diff --git a/docs/commands/controller.md b/docs/commands/controller.md new file mode 100644 index 0000000..513f16d --- /dev/null +++ b/docs/commands/controller.md @@ -0,0 +1,22 @@ +# Controller +Creates a new controller inside the given module. + +> Controllers will be placed in `modules/{Module}/App/Controllers` + +## Usage +```bash +php artisan beyond:make:controller User.Admin/UserAdminController +php artisan beyond:make:controller User.UserController +``` + +### Command +`beyond:make:controller {name} {--api} {--i|invokable} {--force}` + +### Flags +| Name | Short | Description | Example | +|-------------------|-------|----------------------------------|---------| +| --api | | Creates a API controller | | +| --i / --invokable | | Creates an invokable controller | | +| --force | | | | + + diff --git a/docs/installation.md b/docs/installation.md index d743e27..41c63cc 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -1,20 +1,12 @@ # Installation -It's recommended to install `laravel-beyond` with [composer](https://getcomposer.org). +It's recommended to install Laravel Beyond with [composer](https://getcomposer.org). ```bash composer require --dev akrillia/laravel-beyond ``` ## Requirements - -### v7.x -| Package | Version | -|---------|---------| -| php | ^8.2 | -| Laravel | ^10.x | - -### v6.x -| Package | Version | -|---------|-------------| -| php | ^8.1 | -| Laravel | ^9.x\|^10.x | \ No newline at end of file +| Version | PHP | Laravel | +|---------|------|--------------| +| 7.x | ^8.2 | ^10.x | +| 6.x | ^8.1 | ^9.x / ^10.x | diff --git a/tests/DocumentationTest/ActionTest.php b/tests/DocumentationTest/ActionTest.php new file mode 100644 index 0000000..d8ff731 --- /dev/null +++ b/tests/DocumentationTest/ActionTest.php @@ -0,0 +1,21 @@ +path; + $contents = file_get_contents($file); + + $this->assertFileExists($file); + $this->assertStringContainsString('# Action', $contents); + $this->assertStringContainsString('modules/{Module}/Domain/Actions', $contents); + $this->assertStringContainsString('beyond:make:action {name} {--force}', $contents); + } +} diff --git a/tests/DocumentationTest/BuilderTest.php b/tests/DocumentationTest/BuilderTest.php new file mode 100644 index 0000000..4562c4f --- /dev/null +++ b/tests/DocumentationTest/BuilderTest.php @@ -0,0 +1,21 @@ +path; + $contents = file_get_contents($file); + + $this->assertFileExists($file); + $this->assertStringContainsString('# Builder', $contents); + $this->assertStringContainsString('modules/{Module}/Domain/Builders', $contents); + $this->assertStringContainsString('beyond:make:builder {name} {--force}', $contents); + } +} diff --git a/tests/DocumentationTest/CollectionTest.php b/tests/DocumentationTest/CollectionTest.php new file mode 100644 index 0000000..a6f0dd5 --- /dev/null +++ b/tests/DocumentationTest/CollectionTest.php @@ -0,0 +1,21 @@ +path; + $contents = file_get_contents($file); + + $this->assertFileExists($file); + $this->assertStringContainsString('# Collection', $contents); + $this->assertStringContainsString('modules/{Module}/Domain/Collections', $contents); + $this->assertStringContainsString('beyond:make:collection {name} {--model=} {--force}', $contents); + } +} diff --git a/tests/DocumentationTest/CommandTest.php b/tests/DocumentationTest/CommandTest.php new file mode 100644 index 0000000..cb12213 --- /dev/null +++ b/tests/DocumentationTest/CommandTest.php @@ -0,0 +1,21 @@ +path; + $contents = file_get_contents($file); + + $this->assertFileExists($file); + $this->assertStringContainsString('# Command', $contents); + $this->assertStringContainsString('modules/{Module}/App/Commands', $contents); + $this->assertStringContainsString('beyond:make:command {name} {--command=command:name} {--force}', $contents); + } +} diff --git a/tests/DocumentationTest/ControllerTest.php b/tests/DocumentationTest/ControllerTest.php new file mode 100644 index 0000000..242b3da --- /dev/null +++ b/tests/DocumentationTest/ControllerTest.php @@ -0,0 +1,21 @@ +path; + $contents = file_get_contents($file); + + $this->assertFileExists($file); + $this->assertStringContainsString('# Controller', $contents); + $this->assertStringContainsString('modules/{Module}/App/Controllers', $contents); + $this->assertStringContainsString('beyond:make:controller {name} {--api} {--i|invokable} {--force}', $contents); + } +} diff --git a/tests/DocumentationTest/DataObjectTest.php b/tests/DocumentationTest/DataObjectTest.php new file mode 100644 index 0000000..99fd833 --- /dev/null +++ b/tests/DocumentationTest/DataObjectTest.php @@ -0,0 +1,21 @@ +path; + $contents = file_get_contents($file); + + $this->assertFileExists($file); + $this->assertStringContainsString('# Data Object', $contents); + $this->assertStringContainsString('modules/{Module}/Domain/DataObjects', $contents); + $this->assertStringContainsString('beyond:make:data {name} {--force}', $contents); + } +} diff --git a/tests/DocumentationTest/EnumTest.php b/tests/DocumentationTest/EnumTest.php new file mode 100644 index 0000000..65bacd0 --- /dev/null +++ b/tests/DocumentationTest/EnumTest.php @@ -0,0 +1,21 @@ +path; + $contents = file_get_contents($file); + + $this->assertFileExists($file); + $this->assertStringContainsString('# Enum', $contents); + $this->assertStringContainsString('modules/{Module}/Domain/Enum', $contents); + $this->assertStringContainsString('beyond:make:enum {name} {--force}', $contents); + } +} diff --git a/tests/DocumentationTest/EventTest.php b/tests/DocumentationTest/EventTest.php new file mode 100644 index 0000000..1a9ae9a --- /dev/null +++ b/tests/DocumentationTest/EventTest.php @@ -0,0 +1,21 @@ +path; + $contents = file_get_contents($file); + + $this->assertFileExists($file); + $this->assertStringContainsString('# Event', $contents); + $this->assertStringContainsString('modules/{Module}/Domain/Events', $contents); + $this->assertStringContainsString('beyond:make:event {name} {--force}', $contents); + } +} diff --git a/tests/DocumentationTest/JobTest.php b/tests/DocumentationTest/JobTest.php new file mode 100644 index 0000000..1aad6a5 --- /dev/null +++ b/tests/DocumentationTest/JobTest.php @@ -0,0 +1,21 @@ +path; + $contents = file_get_contents($file); + + $this->assertFileExists($file); + $this->assertStringContainsString('# Job', $contents); + $this->assertStringContainsString('modules/{Module}/App/Jobs', $contents); + $this->assertStringContainsString('beyond:make:job {name} {--sync} {--force}', $contents); + } +} diff --git a/tests/DocumentationTest/ListenerTest.php b/tests/DocumentationTest/ListenerTest.php new file mode 100644 index 0000000..f7387b5 --- /dev/null +++ b/tests/DocumentationTest/ListenerTest.php @@ -0,0 +1,21 @@ +path; + $contents = file_get_contents($file); + + $this->assertFileExists($file); + $this->assertStringContainsString('# Listener', $contents); + $this->assertStringContainsString('modules/{Module}/App/Listeners', $contents); + $this->assertStringContainsString('beyond:make:listener {name} {--force}', $contents); + } +}