public static function PHPUnit_Util_Test::getMissingRequirements in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/phpunit/phpunit/src/Util/Test.php \PHPUnit_Util_Test::getMissingRequirements()
Returns the missing requirements for a test.
@since Method available since Release 4.3.0
Parameters
string $className:
string $methodName:
Return value
array
3 calls to PHPUnit_Util_Test::getMissingRequirements()
- PHPUnit_Framework_TestCase::checkRequirements in vendor/
phpunit/ phpunit/ src/ Framework/ TestCase.php - @since Method available since Release 3.6.0
- PHPUnit_Framework_TestSuite::run in vendor/
phpunit/ phpunit/ src/ Framework/ TestSuite.php - Runs the tests and collects their result in a TestResult.
- Util_TestTest::testGetMissingRequirements in vendor/
phpunit/ phpunit/ tests/ Util/ TestTest.php - @covers PHPUnit_Util_Test::getMissingRequirements @dataProvider missingRequirementsProvider
File
- vendor/
phpunit/ phpunit/ src/ Util/ Test.php, line 214
Class
- PHPUnit_Util_Test
- Test helpers.
Code
public static function getMissingRequirements($className, $methodName) {
$required = static::getRequirements($className, $methodName);
$missing = array();
if (!empty($required['PHP']) && version_compare(PHP_VERSION, $required['PHP'], '<')) {
$missing[] = sprintf('PHP %s (or later) is required.', $required['PHP']);
}
if (!empty($required['PHPUnit'])) {
$phpunitVersion = PHPUnit_Runner_Version::id();
if (version_compare($phpunitVersion, $required['PHPUnit'], '<')) {
$missing[] = sprintf('PHPUnit %s (or later) is required.', $required['PHPUnit']);
}
}
if (!empty($required['OS']) && !preg_match($required['OS'], PHP_OS)) {
$missing[] = sprintf('Operating system matching %s is required.', $required['OS']);
}
if (!empty($required['functions'])) {
foreach ($required['functions'] as $function) {
$pieces = explode('::', $function);
if (2 === count($pieces) && method_exists($pieces[0], $pieces[1])) {
continue;
}
if (function_exists($function)) {
continue;
}
$missing[] = sprintf('Function %s is required.', $function);
}
}
if (!empty($required['extensions'])) {
foreach ($required['extensions'] as $extension) {
if (!extension_loaded($extension)) {
$missing[] = sprintf('Extension %s is required.', $extension);
}
}
}
return $missing;
}