Skip to content

Commit

Permalink
Tester: fixed compatibility with newer Nette and Tester
Browse files Browse the repository at this point in the history
  • Loading branch information
fprochazka committed Dec 17, 2013
1 parent 65bde3f commit 5d8b416
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tests/KdybyTests/Redis/AbstractRedisTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Kdyby;
use Kdyby\Redis\RedisClient;
use Kdyby\Redis\RedisClientException;
use Nette\Utils\PhpGenerator as Code;
use Nette\PhpGenerator as Code;
use Nette\Reflection\ClassType;
use Nette\Reflection\GlobalFunction;
use Nette\Utils\AssertionException;
Expand All @@ -14,6 +14,9 @@
use Tester;


if (!class_exists('Nette\PhpGenerator\Helpers')) {
class_alias('Nette\Utils\PhpGenerator\Helpers', 'Nette\PhpGenerator\Helpers');
}

/**
* @author Filip Procházka <[email protected]>
Expand Down Expand Up @@ -83,7 +86,7 @@ protected function threadStress(\Closure $closure, $repeat = 100, $jobs = 30)
$scriptFile = TEMP_DIR . '/scripts/' . md5(get_class($this)) . '.phpt';
if (!is_dir($dir = dirname($scriptFile))) {
@umask(0);
mkdir($dir, 0777);
mkdir($dir, 0777, TRUE);
}

$extractor = new ClosureExtractor($closure);
Expand All @@ -92,11 +95,12 @@ protected function threadStress(\Closure $closure, $repeat = 100, $jobs = 30)

ob_start();
$runner = new Tester\Runner\Runner(new Tester\Runner\PhpExecutable('php-cgi'));
$runner->jobs = $jobs;
$runner->jobCount = $jobs;
$runner->paths = array($scriptFile);
$result = $runner->run();
list($info) = Strings::match(ob_get_clean(), '~(?:FAILURES|OK)[^\n]+~i');

@unlink($scriptFile);
if ($result !== TRUE) {
Tester\Assert::fail($info);
}
Expand Down

0 comments on commit 5d8b416

Please sign in to comment.