From 5d8b4167a237cf81bc195b527f13bd947ac4ba20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Proch=C3=A1zka?= Date: Tue, 17 Dec 2013 22:57:07 +0100 Subject: [PATCH] Tester: fixed compatibility with newer Nette and Tester --- tests/KdybyTests/Redis/AbstractRedisTestCase.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/KdybyTests/Redis/AbstractRedisTestCase.php b/tests/KdybyTests/Redis/AbstractRedisTestCase.php index dc04812..91dff09 100644 --- a/tests/KdybyTests/Redis/AbstractRedisTestCase.php +++ b/tests/KdybyTests/Redis/AbstractRedisTestCase.php @@ -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; @@ -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 @@ -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); @@ -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); }