@@ -15,7 +15,11 @@ use SixtyEightPublishers\Environment\Debug\EnvDetector;
1515use SixtyEightPublishers \Environment \Bootstrap \EnvBootstrap ;
1616use function assert ;
1717use function uniqid ;
18+ use function explode ;
19+ use function implode ;
20+ use function array_map ;
1821use function file_exists ;
22+ use function version_compare ;
1923use function sys_get_temp_dir ;
2024
2125require __DIR__ . '/../../../bootstrap.php ' ;
@@ -51,7 +55,16 @@ final class EnvironmentExtensionTest extends TestCase
5155
5256 $ tester ->execute ([]);
5357
54- Assert::same (file_get_contents (__DIR__ . '/expectedDebugOutput.txt ' ), $ tester ->getDisplay ());
58+ $ expectedOutput = file_get_contents (
59+ version_compare ($ this ->getDotenvVersion (), '6.0.0 ' , '< ' )
60+ ? __DIR__ . '/expectedDebugOutput.v5.txt '
61+ : __DIR__ . '/expectedDebugOutput.txt ' ,
62+ );
63+
64+ $ expectedOutput = implode ("\n" , array_map ('trim ' , explode ("\n" , $ expectedOutput )));
65+ $ actualOutput = implode ("\n" , array_map ('trim ' , explode ("\n" , $ tester ->getDisplay ())));
66+
67+ Assert::same ($ expectedOutput , $ actualOutput );
5568 }
5669
5770 public function createCommandTester (string $ name ): CommandTester
@@ -84,6 +97,13 @@ final class EnvironmentExtensionTest extends TestCase
8497
8598 return $ configurator ->createContainer ();
8699 }
100+
101+ private function getDotenvVersion (): string
102+ {
103+ $ packages = require __DIR__ . '/../../../../vendor/composer/installed.php ' ;
104+
105+ return $ packages ['versions ' ]['symfony/dotenv ' ]['version ' ];
106+ }
87107}
88108
89109(new EnvironmentExtensionTest ())->run ();
0 commit comments