diff --git a/app/sprinkles/core/src/Database/Migrator/MigrationLocator.php b/app/sprinkles/core/src/Database/Migrator/MigrationLocator.php index 58f4ce6bb..3ee918af1 100644 --- a/app/sprinkles/core/src/Database/Migrator/MigrationLocator.php +++ b/app/sprinkles/core/src/Database/Migrator/MigrationLocator.php @@ -54,7 +54,11 @@ public function getMigrations() $migrations = []; foreach ($migrationFiles as $migrationFile) { - $migrations[] = $this->getMigrationDetails($migrationFile); + // Note that PSR4 insists that all php files must end in PHP, so ignore all + // files that don't end in PHP. + if (preg_match('/php$/', $migrationFile)) { + $migrations[] = $this->getMigrationDetails($migrationFile); + } } return $migrations; diff --git a/app/sprinkles/core/tests/Integration/Database/Migrator/MigrationLocatorTest.php b/app/sprinkles/core/tests/Integration/Database/Migrator/MigrationLocatorTest.php index 44c842263..a5c0fbdcb 100644 --- a/app/sprinkles/core/tests/Integration/Database/Migrator/MigrationLocatorTest.php +++ b/app/sprinkles/core/tests/Integration/Database/Migrator/MigrationLocatorTest.php @@ -90,6 +90,7 @@ public function testGetMigrations() new Resource($resourceStream, $resourceAccountLocation, 'one/CreatePasswordResetsTable.php'), new Resource($resourceStream, $resourceAccountLocation, 'two/CreateFlightsTable.php'), new Resource($resourceStream, $resourceAccountLocation, 'CreateMainTable.php'), + new Resource($resourceStream, $resourceAccountLocation, 'README.md'), // This shoudn't be returned by the migrator ]); // Create a new MigrationLocator instance with our simulated ResourceLocation @@ -109,7 +110,6 @@ public function testGetMigrations() ]; // Test results match expectations - $this->assertCount(8, $results); $this->assertEquals($expected, $results); return $locator;