Permalink
Browse files

removed PHP < 7.1 stuff

  • Loading branch information...
dg committed Mar 20, 2018
1 parent 285563e commit 81dac58ecdf6f0ae05fa1584f71f3e940a21bf0d
@@ -42,7 +42,7 @@ public static function start($file)
}
self::$file = fopen($file, 'c+');
if (defined('PHPDBG_VERSION') && PHP_VERSION_ID >= 70000) {
if (defined('PHPDBG_VERSION')) {
phpdbg_start_oplog();
self::$collector = 'collectPhpDbg';
@@ -51,8 +51,7 @@ public static function start($file)
self::$collector = 'collectXdebug';
} else {
$alternative = PHP_VERSION_ID >= 70000 ? ' or phpdbg SAPI' : '';
throw new \LogicException("Code coverage functionality requires Xdebug extension$alternative.");
throw new \LogicException('Code coverage functionality requires Xdebug extension or phpdbg SAPI.');
}
register_shutdown_function(function () {
@@ -50,11 +50,7 @@ public static function toLine($var)
return "$var";
} elseif (is_float($var)) {
if (!is_finite($var)) {
return str_replace('.0', '', var_export($var, true)); // workaround for PHP 7.0.2
}
$var = str_replace(',', '.', "$var");
return strpos($var, '.') === false ? $var . '.0' : $var; // workaround for PHP < 7.0.2
return var_export($var, true);
} elseif (is_string($var)) {
if (preg_match('#^(.{' . self::$maxLength . '}).#su', $var, $m)) {
@@ -204,7 +200,7 @@ private static function _toPhp(&$var, &$list = [], $level = 0, &$line = 1)
return "/* Closure defined in file {$rc->getFileName()} on line {$rc->getStartLine()} */";
} elseif (is_object($var)) {
if (PHP_VERSION_ID >= 70000 && ($rc = new \ReflectionObject($var)) && $rc->isAnonymous()) {
if (($rc = new \ReflectionObject($var))->isAnonymous()) {
return "/* Anonymous class defined in file {$rc->getFileName()} on line {$rc->getStartLine()} */";
}
$arr = (array) $var;
@@ -229,8 +229,7 @@ private function createRunner()
private function prepareCodeCoverage()
{
if (!$this->interpreter->canMeasureCodeCoverage()) {
$alternative = PHP_VERSION_ID >= 70000 ? ' or phpdbg SAPI' : '';
throw new \Exception("Code coverage functionality requires Xdebug extension$alternative (used {$this->interpreter->getCommandLine()})");
throw new \Exception("Code coverage functionality requires Xdebug extension or phpdbg SAPI (used {$this->interpreter->getCommandLine()})");
}
file_put_contents($this->options['--coverage'], '');
$file = realpath($this->options['--coverage']);
@@ -7,7 +7,7 @@ use Tester\FileMock;
require __DIR__ . '/../bootstrap.php';
if (!extension_loaded('xdebug') && (!defined('PHPDBG_VERSION') || PHP_VERSION_ID < 70000)) {
if (!extension_loaded('xdebug') && (!defined('PHPDBG_VERSION'))) {
Tester\Environment::skip('Requires Xdebug or phpdbg SAPI.');
}
@@ -15,11 +15,9 @@ Assert::exception(function () {
throw new Exception('Text 123');
}, Exception::class, 'Text %d%');
if (PHP_VERSION_ID >= 70000) {
Assert::exception(function () {
eval('*');
}, Error::class, 'syntax error%a%');
}
Assert::exception(function () {
eval('*');
}, Error::class, 'syntax error%a%');
Assert::exception(function () {
Assert::exception(function () {
@@ -1,9 +1,5 @@
<?php
/**
* @phpversion 7
*/
use Tester\Assert;
use Tester\Dumper;
@@ -1,9 +1,5 @@
<?php
/**
* @phpversion 5.5
*/
use Tester\Assert;
require __DIR__ . '/../bootstrap.php';
@@ -17,13 +17,8 @@ test(function () {
Assert::same($test, $job->getTest());
Assert::same(231, $job->getExitCode());
if (defined('PHPDBG_VERSION') && PHP_VERSION_ID === 70000) { // bug #71056
Assert::same('Args: one, --two=1, three, --two=2+stderr1+stdout+stderr2', $job->getTest()->stdout);
Assert::same('', $job->getTest()->stdout);
} else {
Assert::same('Args: one, --two=1, three, --two=2+stdout', $job->getTest()->stdout);
Assert::same('+stderr1+stderr2', $job->getTest()->stderr);
}
Assert::same('Args: one, --two=1, three, --two=2+stdout', $job->getTest()->stdout);
Assert::same('+stderr1+stderr2', $job->getTest()->stderr);
if (PHP_SAPI !== 'cli') {
Assert::contains('Nette Tester', $job->getHeaders());

0 comments on commit 81dac58

Please sign in to comment.