Revert "Revert "Update and lock framework test dependencies""
[hiphop-php.git] / hphp / test / frameworks / PHPUnitPatterns.php
blob64ba995b153fb26629aff4790468602be317ad07
1 <?hh
2 class PHPUnitPatterns {
3 // Matches:
4 // PrettyExceptionsTest::testReturnsDiagnostics
5 // Assetic\Test\::testMethods with data set #1 ('getRoot')'
6 // Composer\Test\::testMe with data set "parses dates w/ -"
7 // The "with data set" can either have a # or " after it and then any char
8 // before a resulting " or (
9 // Four \\\\ needed to match one \
10 // stackoverflow.com/questions/4025482/cant-escape-the-backslash-with-regex
11 const string TEST_NAME_PATTERN =
12 "/[_a-zA-Z0-9\\\\]*::[_a-zA-Z0-9]*( with data set (\".*?\"|#[0-9]+))?/";
14 // Matches:
15 // E
16 // .
17 // . 252 / 364 ( 69%)
18 // .\nWarning
19 // That last example happened in Magento
20 const string STATUS_CHAR_GROUP = '[\.SFEIR]';
21 const string STATUS_CODE_PATTERN = '/^'.self::STATUS_CHAR_GROUP.'$|^S+$|^'.self::STATUS_CHAR_GROUP.'(HipHop)|^'.self::STATUS_CHAR_GROUP.'[ \t]*[0-9]* \/ [0-9]* \([ 0-9]*%\)/';
23 // Don't want to parse any more test names after the Time line in the
24 // results. Any test names after that line are probably detailed error
25 // information.
26 const string STOP_PARSING_PATTERN =
27 "/^Time: \d+(\.\d+)? (second[s]?|ms|minute[s]?|hour[s]?), Memory: \d+(\.\d+)/";
29 const string TESTS_OK_PATTERN = "/^OK \(\d+ test[s]?, \d+ assertion[s]?\)/";
30 const string TESTS_FAILURE_PATTERN = "/^Tests: \d+, Assertions: \d+.*[.]/";
32 const string HEADER_PATTERN =
33 "/^PHPUnit \d+.[0-9a-zA-Z\-\.]*( by Sebastian Bergmann.)?/";
35 const string CONFIG_FILE_PATTERN = "/^Configuration read from/";
37 const string XDEBUG_PATTERN = "/^The Xdebug extension is not loaded./";
39 // Paris and Idiorm have tests with ending digits (e.g. Test53.php)
40 const string TEST_FILE_PATTERN =
41 "/.*(\.phpt|Test[\d]*\.php|test[\d]*\.php)$/";
43 const string TESTS_OK_SKIPPED_INC_PATTERN =
44 "/^OK, but incomplete, skipped, or risky tests!/";
45 const string NUM_ERRORS_FAILURES_PATTERN =
46 "/^There (was|were) \d+ (failure|error)[s]?\:/";
47 const string NUM_SKIPS_INC_PATTERN =
48 "/^There (was|were) \d+ (skipped|incomplete) test[s]?\:/";
49 const string FAILURES_HEADER_PATTERN = "/^FAILURES!/";
50 const string NO_TESTS_EXECUTED_PATTERN = "/^No tests executed!/";
52 static string $hhvm_warning_pattern =
53 "/^(HipHop|HHVM|hhvm) (Warning|Notice)/";
54 static string $hhvm_fatal_pattern =
55 "/(^(HipHop|HHVM|hhvm) Fatal)|(^hhvm:)|(^Core dumped: Segmentation fault)/";
57 static string $phpunit_exception_with_hhvm_warning =
58 "/^PHPUnit_Framework_Exception: (HipHop|HHVM|hhvm) (Warning|Notice)/";
59 const string TEST_METHOD_NAME_PATTERN = "/public function test|\@test/";