-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tester: fixed compatibility with newer Nette and Tester
- Loading branch information
1 parent
65bde3f
commit 5d8b416
Showing
1 changed file
with
7 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 <[email protected]> | ||
|
@@ -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); | ||
} | ||
|