diff --git a/src/Command/BakeMigrationDiffCommand.php b/src/Command/BakeMigrationDiffCommand.php index 05fd53b6..9f2e3b5e 100644 --- a/src/Command/BakeMigrationDiffCommand.php +++ b/src/Command/BakeMigrationDiffCommand.php @@ -147,7 +147,7 @@ public function bake(string $name, Arguments $args, ConsoleIo $io): void protected function setup(Arguments $args): void { $this->migrationsPath = $this->getPath($args); - $this->migrationsFiles = glob($this->migrationsPath . '*.php') ?: []; + $this->migrationsFiles = glob($this->migrationsPath . '*\\.php') ?: []; $this->phinxTable = $this->getPhinxTable($this->plugin); $connection = ConnectionManager::get($this->connection); diff --git a/src/Util/TableFinder.php b/src/Util/TableFinder.php index eda13aeb..a23ff61d 100644 --- a/src/Util/TableFinder.php +++ b/src/Util/TableFinder.php @@ -149,7 +149,7 @@ public function findTables(?string $pluginName = null): array return []; } - return array_map('basename', glob($path . '*.php') ?: []); + return array_map('basename', glob($path . '*\\.php') ?: []); } /** diff --git a/tests/TestCase/Command/BakeMigrationSnapshotCommandTest.php b/tests/TestCase/Command/BakeMigrationSnapshotCommandTest.php index 238e3c37..f2ac2b7e 100644 --- a/tests/TestCase/Command/BakeMigrationSnapshotCommandTest.php +++ b/tests/TestCase/Command/BakeMigrationSnapshotCommandTest.php @@ -101,7 +101,7 @@ public function testNotEmptySnapshotNoLock() $bakeName = $this->getBakeName('TestNotEmptySnapshot'); $this->exec("bake migration_snapshot {$bakeName} -c test --no-lock"); - $generatedMigration = glob($this->migrationPath . '*_TestNotEmptySnapshot*.php'); + $generatedMigration = glob($this->migrationPath . '*_TestNotEmptySnapshot*\\.php'); $this->generatedFiles = $generatedMigration; $this->generatedFiles[] = $this->migrationPath . 'schema-dump-test.lock'; $generatedMigration = basename($generatedMigration[0]); @@ -198,7 +198,7 @@ protected function runSnapshotTest(string $scenario, string $arguments = ''): vo $bakeName = $this->getBakeName("TestSnapshot{$scenario}"); $this->exec("bake migration_snapshot {$bakeName} -c test{$arguments}"); - $generatedMigration = glob($this->migrationPath . "*_TestSnapshot{$scenario}*.php"); + $generatedMigration = glob($this->migrationPath . "*_TestSnapshot{$scenario}*\\.php"); $this->generatedFiles = $generatedMigration; $this->generatedFiles[] = $this->migrationPath . 'schema-dump-test.lock'; diff --git a/tests/TestCase/Command/Phinx/CreateTest.php b/tests/TestCase/Command/Phinx/CreateTest.php index 67d6062c..a7398440 100644 --- a/tests/TestCase/Command/Phinx/CreateTest.php +++ b/tests/TestCase/Command/Phinx/CreateTest.php @@ -99,7 +99,7 @@ public function testExecute() '--connection' => 'test', ]); - $files = glob(ROOT . DS . 'config' . DS . 'Create' . DS . '*_TestCreateChange*.php'); + $files = glob(ROOT . DS . 'config' . DS . 'Create' . DS . '*_TestCreateChange*\\.php'); $this->generatedFiles = $files; $this->assertNotEmpty($files); diff --git a/tests/TestCase/Util/UtilTest.php b/tests/TestCase/Util/UtilTest.php index a7620401..088d483a 100644 --- a/tests/TestCase/Util/UtilTest.php +++ b/tests/TestCase/Util/UtilTest.php @@ -111,7 +111,7 @@ public function testGlobPath() $this->assertCount(1, $files); $this->assertEquals('empty.txt', basename($files[0])); - $files = Util::glob(__DIR__ . '/_files/migrations/*.php'); + $files = Util::glob(__DIR__ . '/_files/migrations/*\\.php'); $this->assertCount(3, $files); $this->assertEquals('20120111235330_test_migration.php', basename($files[0])); $this->assertEquals('20120116183504_test_migration_2.php', basename($files[1])); @@ -121,8 +121,8 @@ public function testGlobPath() public function testGlobAll() { $files = Util::globAll([ - __DIR__ . '/_files/migrations/*.php', - __DIR__ . '/_files/migrations/subdirectory/*.txt', + __DIR__ . '/_files/migrations/*\\.php', + __DIR__ . '/_files/migrations/subdirectory/*\\.txt', ]); $this->assertCount(4, $files);