forked from nette/tester
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Runner.edge.phpt
41 lines (30 loc) · 1.51 KB
/
Runner.edge.phpt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
use Tester\Assert,
Tester\Runner\Runner;
require __DIR__ . '/bootstrap.php';
require __DIR__ . '/../Tester/Runner/OutputHandler.php';
require __DIR__ . '/../Tester/Runner/TestHandler.php';
require __DIR__ . '/../Tester/Runner/PhpExecutable.php';
require __DIR__ . '/../Tester/Runner/Runner.php';
class Logger implements Tester\Runner\OutputHandler
{
public $results = array();
function result($testName, $result, $message)
{
$this->results[basename($testName)] = array($result, $message);
}
function begin() {}
function end() {}
}
$runner = new Tester\Runner\Runner(createPhp());
$runner->paths[] = __DIR__ . '/edge/*.phptx';
$runner->outputHandlers[] = $logger = new Logger;
$runner->run();
$cli = PHP_SAPI === 'cli';
$bug62725 = $cli && PHP_VERSION_ID >= 50400 && PHP_VERSION_ID <= 50406;
Assert::same($bug62725 ? array(Runner::PASSED, NULL) : array(Runner::FAILED, 'Exited with error code 231 (expected 0)'), $logger->results['shutdown.exitCode.a.phptx']);
$bug65275 = $cli && PHP_VERSION_ID >= 50300; // bug still exists
Assert::same($bug65275 ? array(Runner::FAILED, 'Exited with error code 231 (expected 0)') : array(Runner::PASSED, NULL), $logger->results['shutdown.exitCode.b.phptx']);
Assert::same(array(Runner::SKIPPED, 'just skipping'), $logger->results['skip.phptx']);
Assert::same($bug62725 ? Runner::PASSED : Runner::FAILED, $logger->results['shutdown.assert.phptx'][0]);
Assert::match($bug62725 ? '' : "Failed: 'b' should be%A%", Tester\Dumper::removeColors($logger->results['shutdown.assert.phptx'][1]));