From b6ef3f5d2839896e95b225f2b04f496bf5354f32 Mon Sep 17 00:00:00 2001 From: Pieter Hoste Date: Sat, 17 Jun 2023 17:20:32 +0200 Subject: [PATCH 1/3] Ignore lib/internal/Magento/Framework/App/Test/Unit/_files/app/etc/env.php that gets generated by running unit tests --- lib/internal/Magento/Framework/App/Test/Unit/_files/.gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 lib/internal/Magento/Framework/App/Test/Unit/_files/.gitignore diff --git a/lib/internal/Magento/Framework/App/Test/Unit/_files/.gitignore b/lib/internal/Magento/Framework/App/Test/Unit/_files/.gitignore new file mode 100644 index 0000000000000..fa94d0f315a9a --- /dev/null +++ b/lib/internal/Magento/Framework/App/Test/Unit/_files/.gitignore @@ -0,0 +1 @@ +/app/etc/env.php From 39a2dd8bdd55a92469aa7b4648517e98fd476cfe Mon Sep 17 00:00:00 2001 From: Pieter Hoste Date: Mon, 19 Jun 2023 22:35:36 +0200 Subject: [PATCH 2/3] Instead of ignoring the generated env.php file, let's remove it when it's no longer needed. --- .../Framework/App/Test/Unit/ObjectManagerFactoryTest.php | 5 +++++ .../Magento/Framework/App/Test/Unit/_files/.gitignore | 1 - 2 files changed, 5 insertions(+), 1 deletion(-) delete mode 100644 lib/internal/Magento/Framework/App/Test/Unit/_files/.gitignore diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ObjectManagerFactoryTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ObjectManagerFactoryTest.php index 088e68197b0ff..d53a6dd5b1b09 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/ObjectManagerFactoryTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/ObjectManagerFactoryTest.php @@ -22,10 +22,14 @@ class ObjectManagerFactoryTest extends TestCase /** @var string */ protected static $originalIncludePath; + /** @var File */ + private static $fileIo; + public static function setUpBeforeClass(): void { self::$originalAutoloadFunctions = spl_autoload_functions(); self::$originalIncludePath = get_include_path(); + self::$fileIo = new File(); } /** @@ -41,6 +45,7 @@ public static function tearDownAfterClass(): void } set_include_path(self::$originalIncludePath); File::rmdirRecursive(__DIR__ . '/_files/var/'); + self::$fileIo->rm(__DIR__ . '/_files/app/etc/env.php'); } public function testCreateObjectManagerFactoryCouldBeOverridden() diff --git a/lib/internal/Magento/Framework/App/Test/Unit/_files/.gitignore b/lib/internal/Magento/Framework/App/Test/Unit/_files/.gitignore deleted file mode 100644 index fa94d0f315a9a..0000000000000 --- a/lib/internal/Magento/Framework/App/Test/Unit/_files/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/app/etc/env.php From 32d677350e53b9f188cad922d42122a79dcfb8c9 Mon Sep 17 00:00:00 2001 From: Pieter Hoste Date: Tue, 22 Oct 2024 20:27:06 +0200 Subject: [PATCH 3/3] Fixed copyright header so static tests no longer fail. --- .../Framework/App/Test/Unit/ObjectManagerFactoryTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ObjectManagerFactoryTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ObjectManagerFactoryTest.php index d53a6dd5b1b09..42aa42cbead54 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/ObjectManagerFactoryTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/ObjectManagerFactoryTest.php @@ -1,7 +1,7 @@