parent
2f4063c788
commit
61d864e4f0
|
@ -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];
|
||||
}
|
||||
|
|
26
Tests/PHPCI/Plugin/Util/TapParserTest.php
Normal file
26
Tests/PHPCI/Plugin/Util/TapParserTest.php
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
namespace PHPCI\Plugin\Tests\Util;
|
||||
|
||||
use PHPCI\Plugin\Util\TapParser;
|
||||
|
||||
class TapParserTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testSkipped()
|
||||
{
|
||||
$content = <<<TAP
|
||||
TAP version 13
|
||||
ok 1 - SomeTest::testAnother
|
||||
ok 2 - # SKIP
|
||||
1..2
|
||||
TAP;
|
||||
$parser = new TapParser($content);
|
||||
$result = $parser->parse();
|
||||
|
||||
$this->assertEquals(array(
|
||||
array('pass' => true, 'suite' => 'SomeTest', 'test' => 'testAnother'),
|
||||
array('message' => 'SKIP'),
|
||||
), $result);
|
||||
|
||||
$this->assertEquals(0, $parser->getTotalFailures());
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue