From ea4b86865032e8b26dc011428632cf3e928c5f73 Mon Sep 17 00:00:00 2001 From: Thorsten Bus Date: Mon, 6 Jul 2026 01:31:20 +0200 Subject: [PATCH] fix(test): make song-sections rollback guard test resilient to new migrations --- tests/Feature/SongCcliMetadataTest.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/Feature/SongCcliMetadataTest.php b/tests/Feature/SongCcliMetadataTest.php index d1cdaac..a1e87b2 100644 --- a/tests/Feature/SongCcliMetadataTest.php +++ b/tests/Feature/SongCcliMetadataTest.php @@ -45,8 +45,10 @@ $this->expectException(RuntimeException::class); $this->expectExceptionMessage('Destruktive Migration'); - // The guarded migration (create_song_sections_and_rescope_slides) is 3rd from the top - // of the migration stack (2 newer migrations were added after it). - // Rolling back 3 steps reaches the destructive guard and triggers the RuntimeException. - Artisan::call('migrate:rollback', ['--step' => 3]); + // create_song_sections_and_rescope_slides is a destructive migration whose down() + // throws by design. RefreshDatabase applies every migration in a single batch, so a + // full-batch rollback proceeds newest -> oldest and reaches the guard before touching + // anything older. This stays correct no matter how many migrations are added above the + // guard later: they simply roll back first, then the guard throws the RuntimeException. + Artisan::call('migrate:rollback'); });