Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes UserFrosting#965 - Ignore files that don't end in .php #998

Merged
merged 2 commits into from
Jun 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -109,7 +110,6 @@ public function testGetMigrations()
];

// Test results match expectations
$this->assertCount(8, $results);
$this->assertEquals($expected, $results);

return $locator;
Expand Down