From 297a04c82a6746392cf0e7161953cd2e505bef47 Mon Sep 17 00:00:00 2001 From: Wanderson Date: Thu, 16 Oct 2014 22:38:17 -0300 Subject: [PATCH] Add support for skipped tests in TAP Parser. Closes #624 See #611 --- PHPCI/Plugin/Util/TapParser.php | 3 +++ Tests/PHPCI/Plugin/Util/TapParserTest.php | 26 +++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 Tests/PHPCI/Plugin/Util/TapParserTest.php diff --git a/PHPCI/Plugin/Util/TapParser.php b/PHPCI/Plugin/Util/TapParser.php index 5b099b03..1aa25348 100644 --- a/PHPCI/Plugin/Util/TapParser.php +++ b/PHPCI/Plugin/Util/TapParser.php @@ -8,6 +8,7 @@ class TapParser const TEST_LINE_PATTERN = '/(ok|not ok)\s+[0-9]+\s+\-\s+([^\n]+)::([^\n]+)/'; const TEST_MESSAGE_PATTERN = '/message\:\s+\'([^\']+)\'/'; const TEST_COVERAGE_PATTERN = '/Generating code coverage report/'; + const TEST_SKIP_PATTERN = '/ok\s+[0-9]+\s+\-\s+#\s+SKIP/'; /** * @var string @@ -92,6 +93,8 @@ class TapParser ); $rtn[] = $item; + } elseif (preg_match(self::TEST_SKIP_PATTERN, $line, $matches)) { + $rtn[] = array('message' => 'SKIP'); } elseif (preg_match(self::TEST_MESSAGE_PATTERN, $line, $matches)) { $rtn[count($rtn) - 1]['message'] = $matches[1]; } diff --git a/Tests/PHPCI/Plugin/Util/TapParserTest.php b/Tests/PHPCI/Plugin/Util/TapParserTest.php new file mode 100644 index 00000000..c4438b79 --- /dev/null +++ b/Tests/PHPCI/Plugin/Util/TapParserTest.php @@ -0,0 +1,26 @@ +parse(); + + $this->assertEquals(array( + array('pass' => true, 'suite' => 'SomeTest', 'test' => 'testAnother'), + array('message' => 'SKIP'), + ), $result); + + $this->assertEquals(0, $parser->getTotalFailures()); + } +}