2828use function json_decode ;
2929use function putenv ;
3030use function str_replace ;
31- use function sys_get_temp_dir ;
3231use function trim ;
3332
3433abstract class TestCase extends \PHPUnit \Framework \TestCase
@@ -44,7 +43,7 @@ public function __construct(?string $name = null, array $data = [], $dataName =
4443
4544 $ this ->filesystem = new Filesystem ();
4645 $ this ->sourceDirectory = dirname (__DIR__ ) . '/TestAsset/packages ' ;
47- $ this ->tempDirectory = sys_get_temp_dir ( ) . '/yiisoft ' ;
46+ $ this ->tempDirectory = dirname ( __DIR__ ) . '/runtime/composer ' ;
4847 $ this ->tempConfigsDirectory = "$ this ->tempDirectory /config " ;
4948 }
5049
@@ -143,7 +142,7 @@ protected function assertMergePlan(array $environments = []): void
143142 ],
144143 ],
145144 ], $ environments ),
146- require $ this ->getTempPath (Options::MERGE_PLAN_FILENAME ),
145+ require $ this ->getTempPath (Options::DEFAULT_MERGE_PLAN_FILE ),
147146 );
148147 }
149148
@@ -182,18 +181,20 @@ protected function createComposerMock(
182181 array $ extraEnvironments = [],
183182 array $ vendorOverridePackage = null ,
184183 bool $ buildMergePlan = true ,
185- string $ extraConfigFile = null
184+ string $ extraConfigFile = null ,
185+ ?string $ mergePlanFile = null ,
186186 ) {
187187 $ rootPath = $ this ->tempDirectory ;
188188 $ sourcePath = $ this ->sourceDirectory ;
189189 $ targetPath = "$ this ->tempDirectory /vendor " ;
190190
191- $ extra = array_merge ( [
191+ $ extra = [
192192 'config-plugin-file ' => $ extraConfigFile ,
193193 'config-plugin-options ' => [
194194 'source-directory ' => 'config ' ,
195195 'vendor-override-layer ' => $ vendorOverridePackage ?? 'test/over ' ,
196196 'build-merge-plan ' => $ buildMergePlan ,
197+ 'merge-plan-file ' => $ mergePlanFile ,
197198 ],
198199 'config-plugin ' => [
199200 'empty ' => [],
@@ -207,7 +208,8 @@ protected function createComposerMock(
207208 'web.php ' ,
208209 ],
209210 ],
210- ], ['config-plugin-environments ' => $ extraEnvironments ]);
211+ 'config-plugin-environments ' => $ extraEnvironments ,
212+ ];
211213
212214 $ config = $ this ->createMock (Config::class);
213215 $ config
0 commit comments