- $fileName = wfTempDir() . DIRECTORY_SEPARATOR . uniqid( 'MW_PHPUnit_CSSMinTest_' ) . '.'
- . $fileExtension;
- $this->addTmpFiles( $fileName );
+ // Automatically removed when it falls out of scope (including if the test fails)
+ $file = TempFSFile::factory( 'PHPUnit_CSSMinTest_', $fileExtension, wfTempDir() );
+ $fileName = $file->getPath();