isPHP7() public static method

public static isPHP7 ( string $current = PHP_VERSION ) : boolean
$current string
return boolean
Exemplo n.º 1
0
 public function testIsPHP7()
 {
     isTrue(Sys::isPHP7('7'));
     isTrue(Sys::isPHP7('7.0'));
     isTrue(Sys::isPHP7('7.0.9'));
     isTrue(Sys::isPHP7('7.1'));
     isTrue(Sys::isPHP7('7.1.0alpha1'));
     isFalse(Sys::isPHP7('5.7'));
     isFalse(Sys::isPHP7('5.3'));
 }
Exemplo n.º 2
0
 public function testNestedIndexCoverage()
 {
     $uniq = uniqid();
     $result = httpRequest('http://localhost:8888/folder/not-index.php', array('test' => $uniq));
     isSame('folder/not-index: ' . $uniq, $result->getBody());
     isSame(200, $result->getCode());
     if (Sys::hasXdebug() && !Sys::isPHP7()) {
         isDir(PROJECT_BUILD . '/coverage_cov');
         isDir(PROJECT_BUILD . '/coverage_html');
         isDir(PROJECT_BUILD . '/coverage_xml');
     }
 }
Exemplo n.º 3
0
    if (is_dir($path)) {
        $realIndex = $path . '/index.php';
    } elseif (is_file($path)) {
        if (pathinfo($path, PATHINFO_EXTENSION) !== 'php') {
            return false;
        }
        $realIndex = $path;
    }
}
// Try to find and load composer autoloader
$vendorPaths = [realpath(__DIR__ . '/vendor/autoload.php'), realpath(__DIR__ . '/../vendor/autoload.php'), realpath(__DIR__ . '/../../vendor/autoload.php'), realpath(__DIR__ . '/../../../vendor/autoload.php'), realpath(__DIR__ . '/../../../../vendor/autoload.php'), realpath(__DIR__ . '/../../../../../vendor/autoload.php'), realpath('./vendor/autoload.php')];
foreach ($vendorPaths as $vendorPath) {
    if ($vendorPath && file_exists($vendorPath)) {
        require_once $vendorPath;
        break;
    }
}
// Parse additional options
$cliOptions = new Getopt([[null, 'index', Getopt::OPTIONAL_ARGUMENT], [null, 'cov-src', Getopt::OPTIONAL_ARGUMENT], [null, 'cov-xml', Getopt::OPTIONAL_ARGUMENT], [null, 'cov-cov', Getopt::OPTIONAL_ARGUMENT], [null, 'cov-html', Getopt::OPTIONAL_ARGUMENT]]);
$cliOptions->parse(getenv('PHPUNINT_ARGUMENTS'));
$realIndex = isset($realIndex) ? $realIndex : realpath($cliOptions->getOption('index'));
if (class_exists('\\JBZoo\\PHPUnit\\CovCatcher') && !(Sys::isPHP7() && Sys::hasXdebug())) {
    $testname = (new Data($_REQUEST))->get('testname');
    $coverHash = md5(implode('||', [serialize($_REQUEST), serialize($_SERVER), PHP_VERSION]));
    $coverHash = $testname ? $testname . '-' . $coverHash : $testname;
    $covCatcher = new CovCatcher($coverHash, ['src' => $cliOptions->getOption('cov-src'), 'xml' => $cliOptions->getOption('cov-xml'), 'cov' => $cliOptions->getOption('cov-cov'), 'html' => $cliOptions->getOption('cov-html')]);
    $result = $covCatcher->includeFile($realIndex);
} else {
    $result = (require_once $realIndex);
}
return $result;