From 057efb0ee76931bc89f888a405b19d0c9bc4db3f Mon Sep 17 00:00:00 2001 From: Rob Porter Date: Fri, 2 Apr 2021 15:25:22 -0400 Subject: [PATCH] Adding tests to Set / unset methods --- .../ModelHooks/Hooks/CustomMethod.php | 18 ++++++++++++++++++ .../ModelHooks/Hooks/UnsetMethod.php | 18 ++++++++++++++++++ .../Console/ModelsCommand/ModelHooks/Test.php | 6 +++++- 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 tests/Console/ModelsCommand/ModelHooks/Hooks/CustomMethod.php create mode 100644 tests/Console/ModelsCommand/ModelHooks/Hooks/UnsetMethod.php diff --git a/tests/Console/ModelsCommand/ModelHooks/Hooks/CustomMethod.php b/tests/Console/ModelsCommand/ModelHooks/Hooks/CustomMethod.php new file mode 100644 index 0000000..c9b36ea --- /dev/null +++ b/tests/Console/ModelsCommand/ModelHooks/Hooks/CustomMethod.php @@ -0,0 +1,18 @@ +setMethod('custom', $command->getMethodType($model, Builder::class), ['$custom']); + } +} diff --git a/tests/Console/ModelsCommand/ModelHooks/Hooks/UnsetMethod.php b/tests/Console/ModelsCommand/ModelHooks/Hooks/UnsetMethod.php new file mode 100644 index 0000000..17629ea --- /dev/null +++ b/tests/Console/ModelsCommand/ModelHooks/Hooks/UnsetMethod.php @@ -0,0 +1,18 @@ +unsetMethod('query'); + } +} diff --git a/tests/Console/ModelsCommand/ModelHooks/Test.php b/tests/Console/ModelsCommand/ModelHooks/Test.php index 057cfd2..1bb7231 100644 --- a/tests/Console/ModelsCommand/ModelHooks/Test.php +++ b/tests/Console/ModelsCommand/ModelHooks/Test.php @@ -7,6 +7,8 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\ModelHooks; use Barryvdh\LaravelIdeHelper\Console\ModelsCommand; use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand; use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\ModelHooks\Hooks\CustomProperty; +use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\ModelHooks\Hooks\CustomMethod; +use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\ModelHooks\Hooks\UnsetMethod; use Illuminate\Filesystem\Filesystem; use Mockery; @@ -24,6 +26,8 @@ class Test extends AbstractModelsCommand ], 'model_hooks' => [ CustomProperty::class, + CustomMethod::class, + UnsetMethod::class ], ]); } @@ -71,9 +75,9 @@ use Illuminate\Database\Eloquent\Model; * * @property int $id * @property-read string $custom + * @method static \Illuminate\Database\Eloquent\Builder|Simple custom($custom) * @method static \Illuminate\Database\Eloquent\Builder|Simple newModelQuery() * @method static \Illuminate\Database\Eloquent\Builder|Simple newQuery() - * @method static \Illuminate\Database\Eloquent\Builder|Simple query() * @method static \Illuminate\Database\Eloquent\Builder|Simple whereId($value) * @mixin \Eloquent */