From f6780f3446c98455051e719cac11e37f2391fd62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=2E=20Nagy=20Gerg=C5=91?= Date: Wed, 13 Nov 2024 15:09:34 +0100 Subject: [PATCH] wip --- src/Console/Commands/ClearMedia.php | 2 +- tests/Console/ActionMakeTest.php | 2 +- tests/Console/ClearMediaTest.php | 21 +++++++++++++++++++++ tests/Console/FieldMakeTest.php | 2 +- tests/Console/FilterMakeTest.php | 2 +- tests/Console/ResourceMakeTest.php | 2 +- tests/Console/TrendMakeTest.php | 2 +- tests/Console/ValueMakeTest.php | 2 +- tests/Console/WidgetMakeTest.php | 2 +- 9 files changed, 29 insertions(+), 8 deletions(-) create mode 100644 tests/Console/ClearMediaTest.php diff --git a/src/Console/Commands/ClearMedia.php b/src/Console/Commands/ClearMedia.php index 9e457d85..b21a46a3 100644 --- a/src/Console/Commands/ClearMedia.php +++ b/src/Console/Commands/ClearMedia.php @@ -34,6 +34,6 @@ public function handle(): void $count++; }); - $this->info(sprintf('%d media are cleared!', $count)); + $this->info(sprintf('%d media have been deleted!', $count)); } } diff --git a/tests/Console/ActionMakeTest.php b/tests/Console/ActionMakeTest.php index 66368e51..4aac89e8 100644 --- a/tests/Console/ActionMakeTest.php +++ b/tests/Console/ActionMakeTest.php @@ -13,7 +13,7 @@ public function test_action_make_command(): void $this->artisan('root:action', ['name' => 'TestAction']) ->assertExitCode(Command::SUCCESS); - $this->assertFileExists($this->app->path('/Root/Actions/TestAction.php')); + $this->assertFileExists($this->app->path('Root/Actions/TestAction.php')); } public function tearDown(): void diff --git a/tests/Console/ClearMediaTest.php b/tests/Console/ClearMediaTest.php new file mode 100644 index 00000000..b55fafb4 --- /dev/null +++ b/tests/Console/ClearMediaTest.php @@ -0,0 +1,21 @@ +create(); + + $this->artisan('root:clear-media') + ->expectsOutput('1 media have been deleted!') + ->assertExitCode(Command::SUCCESS); + + $this->assertDatabaseMissing('root_media', ['id' => $medium->getKey()]); + } +} diff --git a/tests/Console/FieldMakeTest.php b/tests/Console/FieldMakeTest.php index 7a67852e..c67f5bdd 100644 --- a/tests/Console/FieldMakeTest.php +++ b/tests/Console/FieldMakeTest.php @@ -16,7 +16,7 @@ public function test_field_make_command(): void ]) ->assertExitCode(Command::SUCCESS); - $this->assertFileExists($this->app->path('/Root/Fields/TestField.php')); + $this->assertFileExists($this->app->path('Root/Fields/TestField.php')); } public function tearDown(): void diff --git a/tests/Console/FilterMakeTest.php b/tests/Console/FilterMakeTest.php index 9e9f9407..7f849253 100644 --- a/tests/Console/FilterMakeTest.php +++ b/tests/Console/FilterMakeTest.php @@ -17,7 +17,7 @@ public function test_filter_make_command(): void ]) ->assertExitCode(Command::SUCCESS); - $this->assertFileExists($this->app->path('/Root/Filters/TestFilter.php')); + $this->assertFileExists($this->app->path('Root/Filters/TestFilter.php')); } public function tearDown(): void diff --git a/tests/Console/ResourceMakeTest.php b/tests/Console/ResourceMakeTest.php index e3dfa5e8..968aea0c 100644 --- a/tests/Console/ResourceMakeTest.php +++ b/tests/Console/ResourceMakeTest.php @@ -13,7 +13,7 @@ public function test_resource_make_command(): void $this->artisan('root:resource', ['name' => 'TestResource']) ->assertExitCode(Command::SUCCESS); - $this->assertFileExists($this->app->path('/Root/Resources/TestResource.php')); + $this->assertFileExists($this->app->path('Root/Resources/TestResource.php')); } public function tearDown(): void diff --git a/tests/Console/TrendMakeTest.php b/tests/Console/TrendMakeTest.php index 554477a6..76b0ca81 100644 --- a/tests/Console/TrendMakeTest.php +++ b/tests/Console/TrendMakeTest.php @@ -13,7 +13,7 @@ public function test_trend_make_command(): void $this->artisan('root:trend', ['name' => 'TrendWidget']) ->assertExitCode(Command::SUCCESS); - $this->assertFileExists($this->app->path('/Root/Widgets/TrendWidget.php')); + $this->assertFileExists($this->app->path('Root/Widgets/TrendWidget.php')); } public function tearDown(): void diff --git a/tests/Console/ValueMakeTest.php b/tests/Console/ValueMakeTest.php index 702cc375..a4c78848 100644 --- a/tests/Console/ValueMakeTest.php +++ b/tests/Console/ValueMakeTest.php @@ -13,7 +13,7 @@ public function test_value_make_command(): void $this->artisan('root:value', ['name' => 'ValueWidget']) ->assertExitCode(Command::SUCCESS); - $this->assertFileExists($this->app->path('/Root/Widgets/ValueWidget.php')); + $this->assertFileExists($this->app->path('Root/Widgets/ValueWidget.php')); } public function tearDown(): void diff --git a/tests/Console/WidgetMakeTest.php b/tests/Console/WidgetMakeTest.php index 3f0667e1..53e09dc5 100644 --- a/tests/Console/WidgetMakeTest.php +++ b/tests/Console/WidgetMakeTest.php @@ -13,7 +13,7 @@ public function test_widget_make_command(): void $this->artisan('root:widget', ['name' => 'TestWidget']) ->assertExitCode(Command::SUCCESS); - $this->assertFileExists($this->app->path('/Root/Widgets/TestWidget.php')); + $this->assertFileExists($this->app->path('Root/Widgets/TestWidget.php')); } public function tearDown(): void