File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
src/Tempest/Framework/Commands
tests/Integration/Database Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 55namespace Tempest \Framework \Commands ;
66
77use Tempest \Console \Console ;
8+ use Tempest \Console \ConsoleArgument ;
89use Tempest \Console \ConsoleCommand ;
910use Tempest \Console \ExitCode ;
1011use Tempest \Container \Singleton ;
@@ -28,10 +29,13 @@ public function __construct(
2829 name: 'migrate:validate ' ,
2930 description: 'Validates the integrity of existing migration files by checking if they have been tampered with. ' ,
3031 )]
31- public function __invoke (): ExitCode
32+ public function __invoke (
33+ #[ConsoleArgument(description: 'Use a specific database. ' )]
34+ ?string $ database = null
35+ ): ExitCode
3236 {
3337 $ this ->console ->header ('Validating migration files ' );
34- $ this ->migrationManager ->validate ();
38+ $ this ->migrationManager ->onDatabase ( $ database )-> validate ();
3539
3640 if (! $ this ->validationPassed ) {
3741 $ this ->console ->writeln ();
Original file line number Diff line number Diff line change @@ -233,4 +233,11 @@ public function test_migrate_down_command(): void
233233 fn () => $ this ->assertTrue (query (Migration::class)->count ()->onDatabase ('backup ' )->execute () > 0 ),
234234 );
235235 }
236+
237+ public function test_migrate_validate_command (): void
238+ {
239+ $ this ->console
240+ ->call ('migrate:validate --database=main ' )
241+ ->assertSuccess ();
242+ }
236243}
You can’t perform that action at this time.
0 commit comments