Consolidation\Cgr\CgrTests::testApplicationWithComposerPassthruCommand PHP Метод

testApplicationWithComposerPassthruCommand() публичный Метод

Functional test with the real composer executable. Use cgr to require cgr, although we do so with --no-update to avoid pointlessly downloading files we do not actually need. We therefore only test to see whether the composer.json file is correctly updated; we cannot test to see if the cgr binary is correctly installed in the appropriate bin directory, as this step is not done.
    public function testApplicationWithComposerPassthruCommand()
    {
        $argv = array('composer', 'init', "--name=test/test", '--no-interaction', '--working-dir=' . $this->workDir);
        $this->application->setOutputFile($this->workDir . '/output.txt');
        $exitCode = $this->application->run($argv, $this->workDir);
        $this->assertEquals(0, $exitCode);
        $this->assertFileExists($this->workDir . '/output.txt', 'Output file created.');
        $this->assertFileExists($this->workDir . '/composer.json', 'composer.json created');
        $composerJson = file_get_contents($this->workDir . '/composer.json');
        $expected = <<<EOT
{
    "name": "test/test",
    "require": {}
}
EOT;
        $this->assertEquals($expected, rtrim($composerJson));
    }