/** * Functional test using a mocked application: we call a * script that echos its arguments and prints the COMPOSER_BIN_DIR * environment variable. * * @dataProvider testApplicationOutputValues */ public function testApplicationOutput($argv, $envArray, $expected) { $this->application->setOutputFile($this->workDir . '/output.txt'); $env = new Env($envArray); $origEnv = $env->apply(); $exitCode = $this->application->run($argv, $this->workDir); $origEnv->apply(); $this->assertFileExists($this->workDir . '/output.txt', 'Output file created.'); $output = file_get_contents($this->workDir . '/output.txt'); $output = str_replace($this->workDir, '{workdir}', $output); //$expected = str_replace('{workdir}', $this->workDir, $expected); $this->assertEquals($expected, rtrim($output)); }