1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-10 00:53:06 +00:00

adjust message, skip test

currently we have no way to put dynamic values or wildcards in EXPECT-OUTPUT
This commit is contained in:
Rob Bast 2016-02-05 13:21:30 +01:00
parent 94daeca57b
commit baabc612f6
3 changed files with 25 additions and 9 deletions

View file

@ -12,6 +12,8 @@
namespace Composer\DependencyResolver;
use Composer\Package\CompletePackage;
/**
* @author Nils Adermann <naderman@naderman.de>
*/
@ -203,27 +205,40 @@ class Rule
if ($targetName === 'php' || $targetName === 'php-64bit' || $targetName === 'hhvm') {
// handle php/hhvm
if (defined('HHVM_VERSION')) {
$text .= ' -> your HHVM version does not satisfy that requirement.';
return $text . ' -> your HHVM version does not satisfy that requirement.';
} elseif ($targetName === 'hhvm') {
$text .= ' -> you are running this with PHP and not HHVM.';
return $text . ' -> you are running this with PHP and not HHVM.';
} else {
$available = $pool->whatProvides($targetName);
$version = count($available) ? $available[0]->getPrettyVersion() : phpversion();
$text .= ' -> your PHP version or "config.platform.php" value ('.$version.') does not satisfy that requirement.';
$packages = $pool->whatProvides($targetName);
$package = count($packages) ? current($packages) : phpversion();
if (!($package instanceof CompletePackage)) {
return $text . ' -> your PHP version ('.phpversion().') does not satisfy that requirement.';
}
$extra = $package->getExtra();
if (!empty($extra['config.platform'])) {
$text .= ' -> your PHP version ('.phpversion().') overriden by "config.platform.php" version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
} else {
$text .= ' -> your PHP version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
}
return $text;
}
} elseif (0 === strpos($targetName, 'ext-')) {
// handle php extensions
$ext = substr($targetName, 4);
$error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';
$text .= ' -> the requested PHP extension '.$ext.' '.$error.'.';
return $text . ' -> the requested PHP extension '.$ext.' '.$error.'.';
} elseif (0 === strpos($targetName, 'lib-')) {
// handle linked libs
$lib = substr($targetName, 4);
$text .= ' -> the requested linked library '.$lib.' has the wrong version installed or is missing from your system, make sure to have the extension providing it.';
return $text . ' -> the requested linked library '.$lib.' has the wrong version installed or is missing from your system, make sure to have the extension providing it.';
} else {
$text .= ' -> no matching package found.';
return $text . ' -> no matching package found.';
}
}