From e557f41e564b083576840bd1823b7b2facc3f018 Mon Sep 17 00:00:00 2001 From: Lonnie Ezell Date: Mon, 18 Feb 2019 22:45:13 -0600 Subject: [PATCH] Manually sort migrations found instead of relying on the OS to do so for us. Fixes #1666 --- system/Database/MigrationRunner.php | 2 ++ tests/system/Database/Migrations/MigrationRunnerTest.php | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/system/Database/MigrationRunner.php b/system/Database/MigrationRunner.php index 89672e3977d2..b0de8c69fe66 100644 --- a/system/Database/MigrationRunner.php +++ b/system/Database/MigrationRunner.php @@ -459,6 +459,8 @@ public function findMigrations() } } + ksort($migrations); + return $migrations; } diff --git a/tests/system/Database/Migrations/MigrationRunnerTest.php b/tests/system/Database/Migrations/MigrationRunnerTest.php index a67ac100f6fe..b494936821aa 100644 --- a/tests/system/Database/Migrations/MigrationRunnerTest.php +++ b/tests/system/Database/Migrations/MigrationRunnerTest.php @@ -181,8 +181,8 @@ public function testFindMigrationsSuccessTimestamp() $migrations = $runner->findMigrations(); $this->assertCount(2, $migrations); - $this->assertEquals($mig1, array_shift($migrations)); $this->assertEquals($mig2, array_shift($migrations)); + $this->assertEquals($mig1, array_shift($migrations)); } public function testFindMigrationsSuccessOrder() @@ -211,8 +211,8 @@ public function testFindMigrationsSuccessOrder() $migrations = $runner->findMigrations(); - $this->assertEquals($mig1, array_shift($migrations)); $this->assertEquals($mig2, array_shift($migrations)); + $this->assertEquals($mig1, array_shift($migrations)); } /**