public function testSymfonyInstallation($versionToInstall, $messageRegexp, $versionRegexp, $requiredPhpVersion)
{
if (version_compare(phpversion(), $requiredPhpVersion, '<')) {
$this->markTestSkipped(sprintf('This test requires PHP %s or higher.', $requiredPhpVersion));
}
$projectDir = sprintf('%s/my_test_project', sys_get_temp_dir());
$this->fs->remove($projectDir);
$output = $this->runCommand(sprintf('php symfony.phar new %s %s', ProcessUtils::escapeArgument($projectDir), $versionToInstall));
$this->assertContains('Downloading Symfony...', $output);
$this->assertRegExp($messageRegexp, $output);
if ('3' === substr($versionToInstall, 0, 1) || '' === $versionToInstall) {
if (PHP_VERSION_ID < 50500) {
$this->markTestSkipped('Symfony 3 requires PHP 5.5.9 or higher.');
}
$output = $this->runCommand('php bin/console --version', $projectDir);
} else {
$output = $this->runCommand('php app/console --version', $projectDir);
}
$this->assertRegExp($versionRegexp, $output);
$composerConfig = json_decode(file_get_contents($projectDir . '/composer.json'), true);
$this->assertArrayNotHasKey(isset($composerConfig['config']) ? 'platform' : 'config', isset($composerConfig['config']) ? $composerConfig['config'] : $composerConfig, 'The composer.json file does not define any platform configuration.');
}