From 11bd8633a662b5f99bb11053fde94ff2d7d2f466 Mon Sep 17 00:00:00 2001 From: Andrey Helldar Date: Mon, 23 Jan 2023 11:50:40 +0300 Subject: [PATCH] Removed mention of old migration mechanics --- .github/ISSUE_TEMPLATE/bug_report.yml | 2 +- docs/how-to-use/rollback.md | 6 +- docs/how-to-use/running.md | 4 +- ide.json | 4 +- tests/Commands/ActionsTest.php | 280 +++++++++--------- tests/Commands/FreshTest.php | 2 +- tests/Commands/RefreshTest.php | 2 +- tests/Commands/ResetTest.php | 4 +- tests/Commands/RollbackTest.php | 122 ++++---- tests/Commands/StatusTest.php | 2 +- tests/Concerns/AssertDatabase.php | 4 +- .../{MigrationTest.php => ActionsTest.php} | 4 +- 12 files changed, 218 insertions(+), 218 deletions(-) rename tests/Migrations/{MigrationTest.php => ActionsTest.php} (92%) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index ea808977..2276e311 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -20,7 +20,7 @@ body: value: | - PHP Version: - Database Driver & Version: - - Migration Actions Version: + - Actions Version: - Laravel Version: validations: required: true diff --git a/docs/how-to-use/rollback.md b/docs/how-to-use/rollback.md index b132b081..a8343017 100644 --- a/docs/how-to-use/rollback.md +++ b/docs/how-to-use/rollback.md @@ -55,8 +55,8 @@ database: php artisan actions:refresh ``` -You may roll back & re-migrate a limited number of actions by providing the `step` option to the `refresh` command. For example, the following command will roll back & -re-migrate the last five actions: +You may roll back & re-run a limited number of actions by providing the `step` option to the `refresh` command. For example, the following command will roll back & +re-run the last five actions: ``` php artisan actions:refresh --step=5 @@ -64,7 +64,7 @@ php artisan actions:refresh --step=5 ## Drop All Actions & Rerun Actions -The `actions:fresh` command will drop all actions records from the actions table and then execute the migrate command: +The `actions:fresh` command will drop all actions records from the actions table and then execute the actions command: ``` php artisan actions:fresh diff --git a/docs/how-to-use/running.md b/docs/how-to-use/running.md index f85265bd..97045675 100644 --- a/docs/how-to-use/running.md +++ b/docs/how-to-use/running.md @@ -24,7 +24,7 @@ bar/2022_10_14_000003_test3 # 3 ## Isolating Action Execution -If you are deploying your application across multiple servers and running actions as part of your deployment process, you likely do not want two servers attempting to migrate +If you are deploying your application across multiple servers and running actions as part of your deployment process, you likely do not want two servers attempting to run the database at the same time. To avoid this, you may use the `isolated` option when invoking the `actions` command. When the `isolated` option is provided, Laravel will acquire an atomic lock using your application's cache driver before attempting to run your actions. All other attempts to @@ -120,7 +120,7 @@ return new class extends Action If the value is `$once = false`, the `up` method will be called every time the `actions` command called. -In this case, information about it will not be written to the `migration_actions` table and, therefore, the `down` method will not be called when the rollback command is called. +In this case, information about it will not be written to the `actions` table and, therefore, the `down` method will not be called when the rollback command is called. > Note > diff --git a/ide.json b/ide.json index 6e27b12b..991114d0 100644 --- a/ide.json +++ b/ide.json @@ -3,8 +3,8 @@ "codeGenerations": [ { "id": "dragon-code.create-action", - "name": "Create Migration Action", - "inputFilter": "migration", + "name": "Create Action", + "inputFilter": "actions", "files": [ { "directory": "/actions", diff --git a/tests/Commands/ActionsTest.php b/tests/Commands/ActionsTest.php index 53d25842..0ecce123 100644 --- a/tests/Commands/ActionsTest.php +++ b/tests/Commands/ActionsTest.php @@ -24,7 +24,7 @@ public function testMigrationCommand() $this->artisan(Names::ACTIONS)->assertExitCode(0); $this->assertDatabaseCount($this->table, 1); - $this->assertDatabaseMigrationHas($this->table, 'test_migration'); + $this->assertDatabaseActionHas($this->table, 'test_migration'); } public function testSameName() @@ -44,7 +44,7 @@ public function testSameName() $this->artisan(Names::ACTIONS)->assertExitCode(0); $this->assertDatabaseCount($this->table, 2); - $this->assertDatabaseMigrationHas($this->table, 'test_migration'); + $this->assertDatabaseActionHas($this->table, 'test_migration'); } public function testOnce() @@ -57,27 +57,27 @@ public function testOnce() $this->assertDatabaseCount($table, 0); $this->assertDatabaseCount($this->table, 0); - $this->assertDatabaseMigrationDoesntLike($this->table, $table); + $this->assertDatabaseActionDoesntLike($this->table, $table); $this->artisan(Names::ACTIONS)->assertExitCode(0); $this->assertDatabaseCount($table, 1); $this->assertDatabaseCount($this->table, 12); - $this->assertDatabaseMigrationDoesntLike($this->table, $table); + $this->assertDatabaseActionDoesntLike($this->table, $table); $this->artisan(Names::ACTIONS)->assertExitCode(0); $this->assertDatabaseCount($table, 2); $this->assertDatabaseCount($this->table, 12); - $this->assertDatabaseMigrationDoesntLike($this->table, $table); + $this->assertDatabaseActionDoesntLike($this->table, $table); $this->artisan(Names::ACTIONS)->assertExitCode(0); $this->assertDatabaseCount($table, 3); $this->assertDatabaseCount($this->table, 12); - $this->assertDatabaseMigrationDoesntLike($this->table, $table); + $this->assertDatabaseActionDoesntLike($this->table, $table); $this->artisan(Names::ACTIONS)->assertExitCode(0); $this->assertDatabaseCount($table, 4); $this->assertDatabaseCount($this->table, 12); - $this->assertDatabaseMigrationDoesntLike($this->table, $table); + $this->assertDatabaseActionDoesntLike($this->table, $table); } public function testSuccessTransaction() @@ -90,12 +90,12 @@ public function testSuccessTransaction() $this->assertDatabaseCount($table, 0); $this->assertDatabaseCount($this->table, 0); - $this->assertDatabaseMigrationDoesntLike($this->table, $table); + $this->assertDatabaseActionDoesntLike($this->table, $table); $this->artisan(Names::ACTIONS)->assertExitCode(0); $this->assertDatabaseCount($table, 3); $this->assertDatabaseCount($this->table, 1); - $this->assertDatabaseMigrationHas($this->table, $table); + $this->assertDatabaseActionHas($this->table, $table); } public function testFailedTransaction() @@ -108,7 +108,7 @@ public function testFailedTransaction() $this->assertDatabaseCount($table, 0); $this->assertDatabaseCount($this->table, 0); - $this->assertDatabaseMigrationDoesntLike($this->table, $table); + $this->assertDatabaseActionDoesntLike($this->table, $table); try { $this->artisan(Names::ACTIONS)->assertExitCode(0); @@ -120,7 +120,7 @@ public function testFailedTransaction() $this->assertDatabaseCount($table, 0); $this->assertDatabaseCount($this->table, 0); - $this->assertDatabaseMigrationDoesntLike($this->table, $table); + $this->assertDatabaseActionDoesntLike($this->table, $table); } public function testSingleEnvironment() @@ -133,29 +133,29 @@ public function testSingleEnvironment() $this->assertDatabaseCount($table, 0); $this->assertDatabaseCount($this->table, 0); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_on_all'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_on_production'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_on_testing'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_except_production'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_except_testing'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_on_all'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_on_production'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_on_testing'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_except_production'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_except_testing'); $this->artisan(Names::ACTIONS)->assertExitCode(0); $this->assertDatabaseCount($table, 5); $this->assertDatabaseCount($this->table, 12); - $this->assertDatabaseMigrationHas($this->table, 'run_on_all'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_on_production'); - $this->assertDatabaseMigrationHas($this->table, 'run_on_testing'); - $this->assertDatabaseMigrationHas($this->table, 'run_except_production'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_except_testing'); + $this->assertDatabaseActionHas($this->table, 'run_on_all'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_on_production'); + $this->assertDatabaseActionHas($this->table, 'run_on_testing'); + $this->assertDatabaseActionHas($this->table, 'run_except_production'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_except_testing'); $this->artisan(Names::ACTIONS)->assertExitCode(0); $this->assertDatabaseCount($table, 5); $this->assertDatabaseCount($this->table, 12); - $this->assertDatabaseMigrationHas($this->table, 'run_on_all'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_on_production'); - $this->assertDatabaseMigrationHas($this->table, 'run_on_testing'); - $this->assertDatabaseMigrationHas($this->table, 'run_except_production'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_except_testing'); + $this->assertDatabaseActionHas($this->table, 'run_on_all'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_on_production'); + $this->assertDatabaseActionHas($this->table, 'run_on_testing'); + $this->assertDatabaseActionHas($this->table, 'run_except_production'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_except_testing'); } public function testManyEnvironments() @@ -168,35 +168,35 @@ public function testManyEnvironments() $this->assertDatabaseCount($table, 0); $this->assertDatabaseCount($this->table, 0); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_on_all'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_on_production'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_on_testing'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_on_many_environments'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_except_production'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_except_testing'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_except_many_environments'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_on_all'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_on_production'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_on_testing'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_on_many_environments'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_except_production'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_except_testing'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_except_many_environments'); $this->artisan(Names::ACTIONS)->assertExitCode(0); $this->assertDatabaseCount($table, 5); $this->assertDatabaseCount($this->table, 12); - $this->assertDatabaseMigrationHas($this->table, 'run_on_all'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_on_production'); - $this->assertDatabaseMigrationHas($this->table, 'run_on_testing'); - $this->assertDatabaseMigrationHas($this->table, 'run_on_many_environments'); - $this->assertDatabaseMigrationHas($this->table, 'run_except_production'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_except_testing'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_except_many_environments'); + $this->assertDatabaseActionHas($this->table, 'run_on_all'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_on_production'); + $this->assertDatabaseActionHas($this->table, 'run_on_testing'); + $this->assertDatabaseActionHas($this->table, 'run_on_many_environments'); + $this->assertDatabaseActionHas($this->table, 'run_except_production'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_except_testing'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_except_many_environments'); $this->artisan(Names::ACTIONS)->assertExitCode(0); $this->assertDatabaseCount($table, 5); $this->assertDatabaseCount($this->table, 12); - $this->assertDatabaseMigrationHas($this->table, 'run_on_all'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_on_production'); - $this->assertDatabaseMigrationHas($this->table, 'run_on_testing'); - $this->assertDatabaseMigrationHas($this->table, 'run_on_many_environments'); - $this->assertDatabaseMigrationHas($this->table, 'run_except_production'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_except_testing'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_except_many_environments'); + $this->assertDatabaseActionHas($this->table, 'run_on_all'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_on_production'); + $this->assertDatabaseActionHas($this->table, 'run_on_testing'); + $this->assertDatabaseActionHas($this->table, 'run_on_many_environments'); + $this->assertDatabaseActionHas($this->table, 'run_except_production'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_except_testing'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_except_many_environments'); } public function testAllow() @@ -209,20 +209,20 @@ public function testAllow() $this->assertDatabaseCount($table, 0); $this->assertDatabaseCount($this->table, 0); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_allow'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_disallow'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_allow'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_disallow'); $this->artisan(Names::ACTIONS)->assertExitCode(0); $this->assertDatabaseCount($table, 5); $this->assertDatabaseCount($this->table, 12); - $this->assertDatabaseMigrationHas($this->table, 'run_allow'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_disallow'); + $this->assertDatabaseActionHas($this->table, 'run_allow'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_disallow'); $this->artisan(Names::ACTIONS)->assertExitCode(0); $this->assertDatabaseCount($table, 5); $this->assertDatabaseCount($this->table, 12); - $this->assertDatabaseMigrationHas($this->table, 'run_allow'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_disallow'); + $this->assertDatabaseActionHas($this->table, 'run_allow'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_disallow'); } public function testUpSuccess() @@ -235,12 +235,12 @@ public function testUpSuccess() $this->assertDatabaseCount($table, 0); $this->assertDatabaseCount($this->table, 0); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_success'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_success'); $this->artisan(Names::ACTIONS)->assertExitCode(0); $this->assertDatabaseCount($table, 2); $this->assertDatabaseCount($this->table, 12); - $this->assertDatabaseMigrationHas($this->table, 'run_success'); + $this->assertDatabaseActionHas($this->table, 'run_success'); } public function testUpSuccessOnFailed() @@ -253,12 +253,12 @@ public function testUpSuccessOnFailed() $this->assertDatabaseCount($table, 0); $this->assertDatabaseCount($this->table, 0); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_success_on_failed'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_success_on_failed'); $this->artisan(Names::ACTIONS)->assertExitCode(0); $this->assertDatabaseCount($table, 2); $this->assertDatabaseCount($this->table, 12); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_success_on_failed'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_success_on_failed'); try { $this->copySuccessFailureMethod(); @@ -275,7 +275,7 @@ public function testUpSuccessOnFailed() $this->assertDatabaseCount($table, 2); $this->assertDatabaseCount($this->table, 12); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_success_on_failed'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_success_on_failed'); } public function testUpFailed() @@ -288,12 +288,12 @@ public function testUpFailed() $this->assertDatabaseCount($table, 0); $this->assertDatabaseCount($this->table, 0); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_failed'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_failed'); $this->artisan(Names::ACTIONS)->assertExitCode(0); $this->assertDatabaseCount($table, 0); $this->assertDatabaseCount($this->table, 12); - $this->assertDatabaseMigrationHas($this->table, 'run_failed'); + $this->assertDatabaseActionHas($this->table, 'run_failed'); } public function testUpFailedOnException() @@ -306,12 +306,12 @@ public function testUpFailedOnException() $this->assertDatabaseCount($table, 0); $this->assertDatabaseCount($this->table, 0); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_failed_failure'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_failed_failure'); $this->artisan(Names::ACTIONS)->assertExitCode(0); $this->assertDatabaseCount($table, 0); $this->assertDatabaseCount($this->table, 12); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_failed_failure'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_failed_failure'); try { $this->copyFailedMethod(); @@ -328,7 +328,7 @@ public function testUpFailedOnException() $this->assertDatabaseCount($table, 0); $this->assertDatabaseCount($this->table, 12); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_failed_failure'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_failed_failure'); } public function testPathAsFileWithExtension() @@ -343,12 +343,12 @@ public function testPathAsFileWithExtension() $this->assertDatabaseCount($table, 0); $this->assertDatabaseCount($this->table, 0); - $this->assertDatabaseMigrationDoesntLike($this->table, 'baz'); + $this->assertDatabaseActionDoesntLike($this->table, 'baz'); $this->artisan(Names::ACTIONS, ['--path' => $path])->assertExitCode(0); $this->assertDatabaseCount($table, 1); $this->assertDatabaseCount($this->table, 1); - $this->assertDatabaseMigrationHas($this->table, 'baz'); + $this->assertDatabaseActionHas($this->table, 'baz'); $this->assertSame('sub_path/2021_12_15_205804_baz', $this->table()->first()->action); } @@ -365,12 +365,12 @@ public function testPathAsFileWithoutExtension() $this->assertDatabaseCount($table, 0); $this->assertDatabaseCount($this->table, 0); - $this->assertDatabaseMigrationDoesntLike($this->table, 'baz'); + $this->assertDatabaseActionDoesntLike($this->table, 'baz'); $this->artisan(Names::ACTIONS, ['--path' => $path])->assertExitCode(0); $this->assertDatabaseCount($table, 1); $this->assertDatabaseCount($this->table, 1); - $this->assertDatabaseMigrationHas($this->table, 'baz'); + $this->assertDatabaseActionHas($this->table, 'baz'); $this->assertSame($path, $this->table()->first()->action); } @@ -387,17 +387,17 @@ public function testPathAsDirectory() $this->assertDatabaseCount($table, 0); $this->assertDatabaseCount($this->table, 0); - $this->assertDatabaseMigrationDoesntLike($this->table, 'baz'); + $this->assertDatabaseActionDoesntLike($this->table, 'baz'); $this->artisan(Names::ACTIONS, ['--path' => $path])->assertExitCode(0); $this->assertDatabaseCount($table, 2); $this->assertDatabaseCount($this->table, 2); - $this->assertDatabaseMigrationHas($this->table, 'baz'); + $this->assertDatabaseActionHas($this->table, 'baz'); $this->assertSame('sub_path/2021_12_15_205804_baz', $this->table()->first()->action); } - public function testMigrationNotFound() + public function testActionNotFound() { $this->assertDatabaseDoesntTable($this->table); @@ -418,20 +418,20 @@ public function testDisabledBefore() $this->assertDatabaseCount($table, 0); $this->assertDatabaseCount($this->table, 0); - $this->assertDatabaseMigrationDoesntLike($this->table, 'test_before_enabled'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'test_before_disabled'); + $this->assertDatabaseActionDoesntLike($this->table, 'test_before_enabled'); + $this->assertDatabaseActionDoesntLike($this->table, 'test_before_disabled'); $this->artisan(Names::ACTIONS)->assertExitCode(0); $this->assertDatabaseCount($table, 2); $this->assertDatabaseCount($this->table, 12); - $this->assertDatabaseMigrationHas($this->table, 'test_before_enabled'); - $this->assertDatabaseMigrationHas($this->table, 'test_before_disabled'); + $this->assertDatabaseActionHas($this->table, 'test_before_enabled'); + $this->assertDatabaseActionHas($this->table, 'test_before_disabled'); $this->artisan(Names::ACTIONS)->assertExitCode(0); $this->assertDatabaseCount($table, 2); $this->assertDatabaseCount($this->table, 12); - $this->assertDatabaseMigrationHas($this->table, 'test_before_enabled'); - $this->assertDatabaseMigrationHas($this->table, 'test_before_disabled'); + $this->assertDatabaseActionHas($this->table, 'test_before_enabled'); + $this->assertDatabaseActionHas($this->table, 'test_before_disabled'); } public function testEnabledBefore() @@ -444,20 +444,20 @@ public function testEnabledBefore() $this->assertDatabaseCount($table, 0); $this->assertDatabaseCount($this->table, 0); - $this->assertDatabaseMigrationDoesntLike($this->table, 'test_before_enabled'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'test_before_disabled'); + $this->assertDatabaseActionDoesntLike($this->table, 'test_before_enabled'); + $this->assertDatabaseActionDoesntLike($this->table, 'test_before_disabled'); $this->artisan(Names::ACTIONS, ['--before' => true])->assertExitCode(0); $this->assertDatabaseCount($table, 1); $this->assertDatabaseCount($this->table, 11); - $this->assertDatabaseMigrationHas($this->table, 'test_before_enabled'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'test_before_disabled'); + $this->assertDatabaseActionHas($this->table, 'test_before_enabled'); + $this->assertDatabaseActionDoesntLike($this->table, 'test_before_disabled'); $this->artisan(Names::ACTIONS, ['--before' => true])->assertExitCode(0); $this->assertDatabaseCount($table, 1); $this->assertDatabaseCount($this->table, 11); - $this->assertDatabaseMigrationHas($this->table, 'test_before_enabled'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'test_before_disabled'); + $this->assertDatabaseActionHas($this->table, 'test_before_enabled'); + $this->assertDatabaseActionDoesntLike($this->table, 'test_before_disabled'); } public function testMixedBefore() @@ -470,32 +470,32 @@ public function testMixedBefore() $this->assertDatabaseCount($table, 0); $this->assertDatabaseCount($this->table, 0); - $this->assertDatabaseMigrationDoesntLike($this->table, 'test_before_enabled'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'test_before_disabled'); + $this->assertDatabaseActionDoesntLike($this->table, 'test_before_enabled'); + $this->assertDatabaseActionDoesntLike($this->table, 'test_before_disabled'); $this->artisan(Names::ACTIONS, ['--before' => true])->assertExitCode(0); $this->assertDatabaseCount($table, 1); $this->assertDatabaseCount($this->table, 11); - $this->assertDatabaseMigrationHas($this->table, 'test_before_enabled'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'test_before_disabled'); + $this->assertDatabaseActionHas($this->table, 'test_before_enabled'); + $this->assertDatabaseActionDoesntLike($this->table, 'test_before_disabled'); $this->artisan(Names::ACTIONS, ['--before' => true])->assertExitCode(0); $this->assertDatabaseCount($table, 1); $this->assertDatabaseCount($this->table, 11); - $this->assertDatabaseMigrationHas($this->table, 'test_before_enabled'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'test_before_disabled'); + $this->assertDatabaseActionHas($this->table, 'test_before_enabled'); + $this->assertDatabaseActionDoesntLike($this->table, 'test_before_disabled'); $this->artisan(Names::ACTIONS)->assertExitCode(0); $this->assertDatabaseCount($table, 2); $this->assertDatabaseCount($this->table, 12); - $this->assertDatabaseMigrationHas($this->table, 'test_before_enabled'); - $this->assertDatabaseMigrationHas($this->table, 'test_before_disabled'); + $this->assertDatabaseActionHas($this->table, 'test_before_enabled'); + $this->assertDatabaseActionHas($this->table, 'test_before_disabled'); $this->artisan(Names::ACTIONS)->assertExitCode(0); $this->assertDatabaseCount($table, 2); $this->assertDatabaseCount($this->table, 12); - $this->assertDatabaseMigrationHas($this->table, 'test_before_enabled'); - $this->assertDatabaseMigrationHas($this->table, 'test_before_disabled'); + $this->assertDatabaseActionHas($this->table, 'test_before_enabled'); + $this->assertDatabaseActionHas($this->table, 'test_before_disabled'); } public function testDI(): void @@ -508,22 +508,22 @@ public function testDI(): void $this->assertDatabaseCount($table, 0); $this->assertDatabaseCount($this->table, 0); - $this->assertDatabaseMigrationDoesntLike($this->table, 'invoke'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'invoke_down'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'up_down'); - $this->assertDatabaseMigrationDoesntLike($table, 'up_down', column: 'value'); - $this->assertDatabaseMigrationDoesntLike($table, 'invoke_down', column: 'value'); - $this->assertDatabaseMigrationDoesntLike($table, 'invoke', column: 'value'); + $this->assertDatabaseActionDoesntLike($this->table, 'invoke'); + $this->assertDatabaseActionDoesntLike($this->table, 'invoke_down'); + $this->assertDatabaseActionDoesntLike($this->table, 'up_down'); + $this->assertDatabaseActionDoesntLike($table, 'up_down', column: 'value'); + $this->assertDatabaseActionDoesntLike($table, 'invoke_down', column: 'value'); + $this->assertDatabaseActionDoesntLike($table, 'invoke', column: 'value'); $this->artisan(Names::ACTIONS)->assertExitCode(0); $this->assertDatabaseCount($table, 3); $this->assertDatabaseCount($this->table, 3); - $this->assertDatabaseMigrationHas($this->table, 'invoke'); - $this->assertDatabaseMigrationHas($this->table, 'invoke_down'); - $this->assertDatabaseMigrationHas($this->table, 'up_down'); - $this->assertDatabaseMigrationHas($table, 'up_down', column: 'value'); - $this->assertDatabaseMigrationHas($table, 'invoke_down', column: 'value'); - $this->assertDatabaseMigrationHas($table, 'invoke', column: 'value'); + $this->assertDatabaseActionHas($this->table, 'invoke'); + $this->assertDatabaseActionHas($this->table, 'invoke_down'); + $this->assertDatabaseActionHas($this->table, 'up_down'); + $this->assertDatabaseActionHas($table, 'up_down', column: 'value'); + $this->assertDatabaseActionHas($table, 'invoke_down', column: 'value'); + $this->assertDatabaseActionHas($table, 'invoke', column: 'value'); } public function testSorting(): void @@ -570,42 +570,42 @@ public function testDirectoryExclusion() $this->assertDatabaseCount($table, 0); $this->assertDatabaseCount($this->table, 0); - $this->assertDatabaseMigrationDoesntLike($this->table, $table); - $this->assertDatabaseMigrationDoesntLike($this->table, 'sub_path'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'sub_path/2021_12_15_205804_baz'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'sub_path/2022_10_27_230732_foo'); + $this->assertDatabaseActionDoesntLike($this->table, $table); + $this->assertDatabaseActionDoesntLike($this->table, 'sub_path'); + $this->assertDatabaseActionDoesntLike($this->table, 'sub_path/2021_12_15_205804_baz'); + $this->assertDatabaseActionDoesntLike($this->table, 'sub_path/2022_10_27_230732_foo'); $this->artisan(Names::ACTIONS)->assertExitCode(0); $this->assertDatabaseCount($table, 1); $this->assertDatabaseCount($this->table, 10); - $this->assertDatabaseMigrationDoesntLike($this->table, $table); - $this->assertDatabaseMigrationDoesntLike($this->table, 'sub_path'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'sub_path/2021_12_15_205804_baz'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'sub_path/2022_10_27_230732_foo'); + $this->assertDatabaseActionDoesntLike($this->table, $table); + $this->assertDatabaseActionDoesntLike($this->table, 'sub_path'); + $this->assertDatabaseActionDoesntLike($this->table, 'sub_path/2021_12_15_205804_baz'); + $this->assertDatabaseActionDoesntLike($this->table, 'sub_path/2022_10_27_230732_foo'); $this->artisan(Names::ACTIONS)->assertExitCode(0); $this->assertDatabaseCount($table, 2); $this->assertDatabaseCount($this->table, 10); - $this->assertDatabaseMigrationDoesntLike($this->table, $table); - $this->assertDatabaseMigrationDoesntLike($this->table, 'sub_path'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'sub_path/2021_12_15_205804_baz'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'sub_path/2022_10_27_230732_foo'); + $this->assertDatabaseActionDoesntLike($this->table, $table); + $this->assertDatabaseActionDoesntLike($this->table, 'sub_path'); + $this->assertDatabaseActionDoesntLike($this->table, 'sub_path/2021_12_15_205804_baz'); + $this->assertDatabaseActionDoesntLike($this->table, 'sub_path/2022_10_27_230732_foo'); $this->artisan(Names::ACTIONS)->assertExitCode(0); $this->assertDatabaseCount($table, 3); $this->assertDatabaseCount($this->table, 10); - $this->assertDatabaseMigrationDoesntLike($this->table, $table); - $this->assertDatabaseMigrationDoesntLike($this->table, 'sub_path'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'sub_path/2021_12_15_205804_baz'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'sub_path/2022_10_27_230732_foo'); + $this->assertDatabaseActionDoesntLike($this->table, $table); + $this->assertDatabaseActionDoesntLike($this->table, 'sub_path'); + $this->assertDatabaseActionDoesntLike($this->table, 'sub_path/2021_12_15_205804_baz'); + $this->assertDatabaseActionDoesntLike($this->table, 'sub_path/2022_10_27_230732_foo'); $this->artisan(Names::ACTIONS)->assertExitCode(0); $this->assertDatabaseCount($table, 4); $this->assertDatabaseCount($this->table, 10); - $this->assertDatabaseMigrationDoesntLike($this->table, $table); - $this->assertDatabaseMigrationDoesntLike($this->table, 'sub_path'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'sub_path/2021_12_15_205804_baz'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'sub_path/2022_10_27_230732_foo'); + $this->assertDatabaseActionDoesntLike($this->table, $table); + $this->assertDatabaseActionDoesntLike($this->table, 'sub_path'); + $this->assertDatabaseActionDoesntLike($this->table, 'sub_path/2021_12_15_205804_baz'); + $this->assertDatabaseActionDoesntLike($this->table, 'sub_path/2022_10_27_230732_foo'); } public function testFileExclusion() @@ -620,37 +620,37 @@ public function testFileExclusion() $this->assertDatabaseCount($table, 0); $this->assertDatabaseCount($this->table, 0); - $this->assertDatabaseMigrationDoesntLike($this->table, $table); - $this->assertDatabaseMigrationDoesntLike($this->table, 'sub_path/2021_12_15_205804_baz'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'sub_path/2022_10_27_230732_foo'); + $this->assertDatabaseActionDoesntLike($this->table, $table); + $this->assertDatabaseActionDoesntLike($this->table, 'sub_path/2021_12_15_205804_baz'); + $this->assertDatabaseActionDoesntLike($this->table, 'sub_path/2022_10_27_230732_foo'); $this->artisan(Names::ACTIONS)->assertExitCode(0); $this->assertDatabaseCount($table, 1); $this->assertDatabaseCount($this->table, 11); - $this->assertDatabaseMigrationDoesntLike($this->table, $table); - $this->assertDatabaseMigrationDoesntLike($this->table, 'sub_path/2021_12_15_205804_baz'); - $this->assertDatabaseMigrationHas($this->table, 'sub_path/2022_10_27_230732_foo'); + $this->assertDatabaseActionDoesntLike($this->table, $table); + $this->assertDatabaseActionDoesntLike($this->table, 'sub_path/2021_12_15_205804_baz'); + $this->assertDatabaseActionHas($this->table, 'sub_path/2022_10_27_230732_foo'); $this->artisan(Names::ACTIONS)->assertExitCode(0); $this->assertDatabaseCount($table, 2); $this->assertDatabaseCount($this->table, 11); - $this->assertDatabaseMigrationDoesntLike($this->table, $table); - $this->assertDatabaseMigrationDoesntLike($this->table, 'sub_path/2021_12_15_205804_baz'); - $this->assertDatabaseMigrationHas($this->table, 'sub_path/2022_10_27_230732_foo'); + $this->assertDatabaseActionDoesntLike($this->table, $table); + $this->assertDatabaseActionDoesntLike($this->table, 'sub_path/2021_12_15_205804_baz'); + $this->assertDatabaseActionHas($this->table, 'sub_path/2022_10_27_230732_foo'); $this->artisan(Names::ACTIONS)->assertExitCode(0); $this->assertDatabaseCount($table, 3); $this->assertDatabaseCount($this->table, 11); - $this->assertDatabaseMigrationDoesntLike($this->table, $table); - $this->assertDatabaseMigrationDoesntLike($this->table, 'sub_path/2021_12_15_205804_baz'); - $this->assertDatabaseMigrationHas($this->table, 'sub_path/2022_10_27_230732_foo'); + $this->assertDatabaseActionDoesntLike($this->table, $table); + $this->assertDatabaseActionDoesntLike($this->table, 'sub_path/2021_12_15_205804_baz'); + $this->assertDatabaseActionHas($this->table, 'sub_path/2022_10_27_230732_foo'); $this->artisan(Names::ACTIONS)->assertExitCode(0); $this->assertDatabaseCount($table, 4); $this->assertDatabaseCount($this->table, 11); - $this->assertDatabaseMigrationDoesntLike($this->table, $table); - $this->assertDatabaseMigrationDoesntLike($this->table, 'sub_path/2021_12_15_205804_baz'); - $this->assertDatabaseMigrationHas($this->table, 'sub_path/2022_10_27_230732_foo'); + $this->assertDatabaseActionDoesntLike($this->table, $table); + $this->assertDatabaseActionDoesntLike($this->table, 'sub_path/2021_12_15_205804_baz'); + $this->assertDatabaseActionHas($this->table, 'sub_path/2022_10_27_230732_foo'); } public function testEmptyDirectory() @@ -663,7 +663,7 @@ public function testEmptyDirectory() $this->assertDatabaseCount($table, 0); $this->assertDatabaseCount($this->table, 0); - $this->assertDatabaseMigrationDoesntLike($this->table, $table); + $this->assertDatabaseActionDoesntLike($this->table, $table); $this->artisan(Names::ACTIONS)->assertExitCode(0); $this->assertDatabaseCount($table, 0); diff --git a/tests/Commands/FreshTest.php b/tests/Commands/FreshTest.php index b5f389be..6105f399 100644 --- a/tests/Commands/FreshTest.php +++ b/tests/Commands/FreshTest.php @@ -28,6 +28,6 @@ public function testFreshCommand(): void $this->assertDatabaseHasTable($this->table); $this->assertDatabaseCount($this->table, 1); - $this->assertDatabaseMigrationHas($this->table, 'fresh'); + $this->assertDatabaseActionHas($this->table, 'fresh'); } } diff --git a/tests/Commands/RefreshTest.php b/tests/Commands/RefreshTest.php index 107327af..94642de1 100644 --- a/tests/Commands/RefreshTest.php +++ b/tests/Commands/RefreshTest.php @@ -26,6 +26,6 @@ public function testRefreshCommand() $this->assertDatabaseHasTable($this->table); $this->assertDatabaseCount($this->table, 1); - $this->assertDatabaseMigrationHas($this->table, 'refresh'); + $this->assertDatabaseActionHas($this->table, 'refresh'); } } diff --git a/tests/Commands/ResetTest.php b/tests/Commands/ResetTest.php index 17a4bc2b..8457448d 100644 --- a/tests/Commands/ResetTest.php +++ b/tests/Commands/ResetTest.php @@ -21,12 +21,12 @@ public function testResetCommand() $this->assertDatabaseHasTable($this->table); $this->assertDatabaseCount($this->table, 1); - $this->assertDatabaseMigrationHas($this->table, 'reset'); + $this->assertDatabaseActionHas($this->table, 'reset'); $this->artisan(Names::RESET)->assertExitCode(0); $this->assertDatabaseHasTable($this->table); $this->assertDatabaseCount($this->table, 0); - $this->assertDatabaseMigrationDoesntLike($this->table, 'reset'); + $this->assertDatabaseActionDoesntLike($this->table, 'reset'); } } diff --git a/tests/Commands/RollbackTest.php b/tests/Commands/RollbackTest.php index 5b54d561..3cb1b4ac 100644 --- a/tests/Commands/RollbackTest.php +++ b/tests/Commands/RollbackTest.php @@ -27,9 +27,9 @@ public function testRollbackCommand() $this->assertDatabaseHasTable($this->table); $this->assertDatabaseCount($this->table, 2); - $this->assertDatabaseMigrationHas($this->table, 'rollback_one'); - $this->assertDatabaseMigrationHas($this->table, 'rollback_two'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'rollback_tree'); + $this->assertDatabaseActionHas($this->table, 'rollback_one'); + $this->assertDatabaseActionHas($this->table, 'rollback_two'); + $this->assertDatabaseActionDoesntLike($this->table, 'rollback_tree'); $this->artisan(Names::ROLLBACK)->assertExitCode(0); @@ -47,9 +47,9 @@ public function testRollbackCommand() $this->assertDatabaseHasTable($this->table); $this->assertDatabaseCount($this->table, 3); - $this->assertDatabaseMigrationHas($this->table, 'rollback_one'); - $this->assertDatabaseMigrationHas($this->table, 'rollback_two'); - $this->assertDatabaseMigrationHas($this->table, 'rollback_tree'); + $this->assertDatabaseActionHas($this->table, 'rollback_one'); + $this->assertDatabaseActionHas($this->table, 'rollback_two'); + $this->assertDatabaseActionHas($this->table, 'rollback_tree'); } public function testEnvironment() @@ -62,27 +62,27 @@ public function testEnvironment() $this->assertDatabaseCount($table, 0); $this->assertDatabaseCount($this->table, 0); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_on_all'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_on_production'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_on_testing'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_on_many_environments'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_on_all'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_on_production'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_on_testing'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_on_many_environments'); $this->artisan(Names::ACTIONS)->assertExitCode(0); $this->assertDatabaseCount($table, 5); $this->assertDatabaseCount($this->table, 12); - $this->assertDatabaseMigrationHas($this->table, 'run_on_all'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_on_production'); - $this->assertDatabaseMigrationHas($this->table, 'run_on_testing'); - $this->assertDatabaseMigrationHas($this->table, 'run_on_many_environments'); + $this->assertDatabaseActionHas($this->table, 'run_on_all'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_on_production'); + $this->assertDatabaseActionHas($this->table, 'run_on_testing'); + $this->assertDatabaseActionHas($this->table, 'run_on_many_environments'); $this->artisan(Names::ACTIONS)->assertExitCode(0); $this->artisan(Names::ROLLBACK)->assertExitCode(0); $this->assertDatabaseCount($table, 10); $this->assertDatabaseCount($this->table, 0); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_on_all'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_on_production'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_on_testing'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_on_many_environments'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_on_all'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_on_production'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_on_testing'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_on_many_environments'); } public function testDownSuccess() @@ -95,17 +95,17 @@ public function testDownSuccess() $this->assertDatabaseCount($table, 0); $this->assertDatabaseCount($this->table, 0); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_success'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_success'); $this->artisan(Names::ACTIONS)->assertExitCode(0); $this->assertDatabaseCount($table, 2); $this->assertDatabaseCount($this->table, 12); - $this->assertDatabaseMigrationHas($this->table, 'run_success'); + $this->assertDatabaseActionHas($this->table, 'run_success'); $this->artisan(Names::ROLLBACK)->assertExitCode(0); $this->assertDatabaseCount($table, 4); $this->assertDatabaseCount($this->table, 0); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_success'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_success'); } public function testDownSuccessOnFailed() @@ -118,12 +118,12 @@ public function testDownSuccessOnFailed() $this->assertDatabaseCount($table, 0); $this->assertDatabaseCount($this->table, 0); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_success_on_failed'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_success_on_failed'); $this->artisan(Names::ACTIONS)->assertExitCode(0); $this->assertDatabaseCount($table, 2); $this->assertDatabaseCount($this->table, 12); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_success_on_failed'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_success_on_failed'); try { $this->copySuccessFailureMethod(); @@ -132,7 +132,7 @@ public function testDownSuccessOnFailed() $this->assertDatabaseCount($table, 2); $this->assertDatabaseCount($this->table, 13); - $this->assertDatabaseMigrationHas($this->table, 'run_success_on_failed'); + $this->assertDatabaseActionHas($this->table, 'run_success_on_failed'); $this->artisan(Names::ROLLBACK)->assertExitCode(1); } @@ -146,7 +146,7 @@ public function testDownSuccessOnFailed() $this->assertDatabaseCount($table, 2); $this->assertDatabaseCount($this->table, 13); - $this->assertDatabaseMigrationHas($this->table, 'run_success_on_failed'); + $this->assertDatabaseActionHas($this->table, 'run_success_on_failed'); } public function testDownFailed() @@ -159,17 +159,17 @@ public function testDownFailed() $this->assertDatabaseCount($table, 0); $this->assertDatabaseCount($this->table, 0); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_failed'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_failed'); $this->artisan(Names::ACTIONS)->assertExitCode(0); $this->assertDatabaseCount($table, 0); $this->assertDatabaseCount($this->table, 12); - $this->assertDatabaseMigrationHas($this->table, 'run_failed'); + $this->assertDatabaseActionHas($this->table, 'run_failed'); $this->artisan(Names::ROLLBACK)->assertExitCode(0); $this->assertDatabaseCount($table, 0); $this->assertDatabaseCount($this->table, 0); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_failed'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_failed'); } public function testUpFailedOnException() @@ -182,12 +182,12 @@ public function testUpFailedOnException() $this->assertDatabaseCount($table, 0); $this->assertDatabaseCount($this->table, 0); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_failed_failure'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_failed_failure'); $this->artisan(Names::ACTIONS)->assertExitCode(0); $this->assertDatabaseCount($table, 0); $this->assertDatabaseCount($this->table, 12); - $this->assertDatabaseMigrationDoesntLike($this->table, 'run_failed_failure'); + $this->assertDatabaseActionDoesntLike($this->table, 'run_failed_failure'); try { $this->copyFailedMethod(); @@ -206,7 +206,7 @@ public function testUpFailedOnException() $this->assertDatabaseCount($table, 1); $this->assertDatabaseCount($this->table, 13); - $this->assertDatabaseMigrationHas($this->table, 'run_failed_failure'); + $this->assertDatabaseActionHas($this->table, 'run_failed_failure'); } public function testDisabledBefore() @@ -219,22 +219,22 @@ public function testDisabledBefore() $this->assertDatabaseCount($table, 0); $this->assertDatabaseCount($this->table, 0); - $this->assertDatabaseMigrationDoesntLike($this->table, 'test_before_enabled'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'test_before_disabled'); + $this->assertDatabaseActionDoesntLike($this->table, 'test_before_enabled'); + $this->assertDatabaseActionDoesntLike($this->table, 'test_before_disabled'); $this->artisan(Names::ACTIONS)->assertExitCode(0); $this->assertDatabaseCount($table, 2); $this->assertDatabaseCount($this->table, 12); - $this->assertDatabaseMigrationHas($this->table, 'test_before_enabled'); - $this->assertDatabaseMigrationHas($this->table, 'test_before_disabled'); + $this->assertDatabaseActionHas($this->table, 'test_before_enabled'); + $this->assertDatabaseActionHas($this->table, 'test_before_disabled'); $this->artisan(Names::ACTIONS)->assertExitCode(0); $this->artisan(Names::ROLLBACK)->assertExitCode(0); $this->assertDatabaseCount($table, 4); $this->assertDatabaseCount($this->table, 0); - $this->assertDatabaseMigrationDoesntLike($this->table, 'test_before_enabled'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'test_before_disabled'); + $this->assertDatabaseActionDoesntLike($this->table, 'test_before_enabled'); + $this->assertDatabaseActionDoesntLike($this->table, 'test_before_disabled'); } public function testEnabledBefore() @@ -247,22 +247,22 @@ public function testEnabledBefore() $this->assertDatabaseCount($table, 0); $this->assertDatabaseCount($this->table, 0); - $this->assertDatabaseMigrationDoesntLike($this->table, 'test_before_enabled'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'test_before_disabled'); + $this->assertDatabaseActionDoesntLike($this->table, 'test_before_enabled'); + $this->assertDatabaseActionDoesntLike($this->table, 'test_before_disabled'); $this->artisan(Names::ACTIONS, ['--before' => true])->assertExitCode(0); $this->assertDatabaseCount($table, 1); $this->assertDatabaseCount($this->table, 11); - $this->assertDatabaseMigrationHas($this->table, 'test_before_enabled'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'test_before_disabled'); + $this->assertDatabaseActionHas($this->table, 'test_before_enabled'); + $this->assertDatabaseActionDoesntLike($this->table, 'test_before_disabled'); $this->artisan(Names::ACTIONS, ['--before' => true])->assertExitCode(0); $this->artisan(Names::ROLLBACK)->assertExitCode(0); $this->assertDatabaseCount($table, 2); $this->assertDatabaseCount($this->table, 0); - $this->assertDatabaseMigrationDoesntLike($this->table, 'test_before_enabled'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'test_before_disabled'); + $this->assertDatabaseActionDoesntLike($this->table, 'test_before_enabled'); + $this->assertDatabaseActionDoesntLike($this->table, 'test_before_disabled'); } public function testDI(): void @@ -275,32 +275,32 @@ public function testDI(): void $this->assertDatabaseCount($table, 0); $this->assertDatabaseCount($this->table, 0); - $this->assertDatabaseMigrationDoesntLike($this->table, 'invoke'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'invoke_down'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'up_down'); - $this->assertDatabaseMigrationDoesntLike($table, 'up_down', column: 'value'); - $this->assertDatabaseMigrationDoesntLike($table, 'invoke_down', column: 'value'); - $this->assertDatabaseMigrationDoesntLike($table, 'invoke', column: 'value'); + $this->assertDatabaseActionDoesntLike($this->table, 'invoke'); + $this->assertDatabaseActionDoesntLike($this->table, 'invoke_down'); + $this->assertDatabaseActionDoesntLike($this->table, 'up_down'); + $this->assertDatabaseActionDoesntLike($table, 'up_down', column: 'value'); + $this->assertDatabaseActionDoesntLike($table, 'invoke_down', column: 'value'); + $this->assertDatabaseActionDoesntLike($table, 'invoke', column: 'value'); $this->artisan(Names::ACTIONS)->assertExitCode(0); $this->assertDatabaseCount($table, 3); $this->assertDatabaseCount($this->table, 3); - $this->assertDatabaseMigrationHas($this->table, 'invoke'); - $this->assertDatabaseMigrationHas($this->table, 'invoke_down'); - $this->assertDatabaseMigrationHas($this->table, 'up_down'); - $this->assertDatabaseMigrationHas($table, 'up_down', column: 'value'); - $this->assertDatabaseMigrationHas($table, 'invoke_down', column: 'value'); - $this->assertDatabaseMigrationHas($table, 'invoke', column: 'value'); + $this->assertDatabaseActionHas($this->table, 'invoke'); + $this->assertDatabaseActionHas($this->table, 'invoke_down'); + $this->assertDatabaseActionHas($this->table, 'up_down'); + $this->assertDatabaseActionHas($table, 'up_down', column: 'value'); + $this->assertDatabaseActionHas($table, 'invoke_down', column: 'value'); + $this->assertDatabaseActionHas($table, 'invoke', column: 'value'); $this->artisan(Names::ROLLBACK)->assertExitCode(0); $this->assertDatabaseCount($table, 2); $this->assertDatabaseCount($this->table, 0); - $this->assertDatabaseMigrationDoesntLike($this->table, 'invoke'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'invoke_down'); - $this->assertDatabaseMigrationDoesntLike($this->table, 'up_down'); - $this->assertDatabaseMigrationDoesntLike($table, 'up_down', column: 'value'); - $this->assertDatabaseMigrationHas($table, 'invoke_down', column: 'value'); - $this->assertDatabaseMigrationHas($table, 'invoke', column: 'value'); + $this->assertDatabaseActionDoesntLike($this->table, 'invoke'); + $this->assertDatabaseActionDoesntLike($this->table, 'invoke_down'); + $this->assertDatabaseActionDoesntLike($this->table, 'up_down'); + $this->assertDatabaseActionDoesntLike($table, 'up_down', column: 'value'); + $this->assertDatabaseActionHas($table, 'invoke_down', column: 'value'); + $this->assertDatabaseActionHas($table, 'invoke', column: 'value'); } } diff --git a/tests/Commands/StatusTest.php b/tests/Commands/StatusTest.php index f57b5b2e..3c7e7ed5 100644 --- a/tests/Commands/StatusTest.php +++ b/tests/Commands/StatusTest.php @@ -34,6 +34,6 @@ public function testStatusCommand() $this->artisan(Names::STATUS)->assertExitCode(0); - $this->assertDatabaseMigrationHas($this->table, 'status'); + $this->assertDatabaseActionHas($this->table, 'status'); } } diff --git a/tests/Concerns/AssertDatabase.php b/tests/Concerns/AssertDatabase.php index 8c435bc0..e83b7e32 100644 --- a/tests/Concerns/AssertDatabase.php +++ b/tests/Concerns/AssertDatabase.php @@ -22,7 +22,7 @@ protected function assertDatabaseDoesntTable(string $table): void ); } - protected function assertDatabaseMigrationHas(string $table, $value, $connection = null, string $column = 'action'): void + protected function assertDatabaseActionHas(string $table, $value, $connection = null, string $column = 'action'): void { $this->assertDatabaseHasLike($table, $column, $value, $connection); } @@ -37,7 +37,7 @@ protected function assertDatabaseHasLike(string $table, string $column, $value, $this->assertTrue($exists); } - protected function assertDatabaseMigrationDoesntLike(string $table, $value, $connection = null, string $column = 'action'): void + protected function assertDatabaseActionDoesntLike(string $table, $value, $connection = null, string $column = 'action'): void { $this->assertDatabaseDoesntLike($table, $column, $value, $connection); } diff --git a/tests/Migrations/MigrationTest.php b/tests/Migrations/ActionsTest.php similarity index 92% rename from tests/Migrations/MigrationTest.php rename to tests/Migrations/ActionsTest.php index d3c654b5..c2cb5e87 100644 --- a/tests/Migrations/MigrationTest.php +++ b/tests/Migrations/ActionsTest.php @@ -10,9 +10,9 @@ use Illuminate\Support\Facades\Schema; use Tests\TestCase; -class MigrationTest extends TestCase +class ActionsTest extends TestCase { - public function testRunMigrationAfterInstall(): void + public function testRunActionsAfterInstall(): void { if (! class_exists(Driver::class)) { $this->assertTrue(true);