Skip to content

Commit

Permalink
Improved test coverage when php-invoker is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
epdenouden authored and sebastianbergmann committed Sep 8, 2018
1 parent 9a987cb commit 586fe31
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/Regression/GitHub/2085/issue-2085-test-missing-invoker.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
--TEST--
Test CLI flags --enforce-time-limit --default-time-limit when missing php-invoker, has pcntl
--DESCRIPTION--
https://github.com/sebastianbergmann/phpunit/issues/2085
--SKIPIF--
<?php
if (\class_exists(Invoker::class)) {
print "Skip: package phpunit/php-invoker is installed" . PHP_EOL;
}

if (!\extension_loaded('pcntl') || \strpos(\ini_get('disable_functions'), 'pcntl') !== false) {
print "Skip: extension pcntl is required for enforcing time limits" . PHP_EOL;
}
--FILE--
<?php
$_SERVER['argv'][1] = '--no-configuration';
$_SERVER['argv'][2] = '--enforce-time-limit';
$_SERVER['argv'][3] = '--default-time-limit=10';
$_SERVER['argv'][4] = __DIR__ . '/Issue2085Test.php';

require __DIR__ . '/../../../bootstrap.php';
PHPUnit\TextUI\Command::main();
--EXPECTF--
PHPUnit %s by Sebastian Bergmann and contributors.


Error: Package phpunit/php-invoker is required for enforcing time limits
. 1 / 1 (100%)

Time: %s, Memory: %s

OK (1 test, 2 assertions)
2 changes: 2 additions & 0 deletions tests/Regression/GitHub/2085/issue-2085-test.phpt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
--TEST--
Test CLI flags --enforce-time-limit --default-time-limit
--DESCRIPTION--
https://github.com/sebastianbergmann/phpunit/issues/2085
--SKIPIF--
<?php
Expand Down

0 comments on commit 586fe31

Please sign in to comment.