3 namespace Drupal\Tests\simpletest\Unit;
5 use Drupal\Tests\UnitTestCase;
8 * Tests PHPUnit errors are getting converted to Simpletest errors.
12 class PhpUnitErrorTest extends UnitTestCase {
15 * Test errors reported.
17 * @covers ::simpletest_phpunit_xml_to_rows
19 public function testPhpUnitXmlParsing() {
20 require_once __DIR__ . '/../../../simpletest.module';
22 $phpunit_error_xml = __DIR__ . '/../../fixtures/phpunit_error.xml';
24 $res = simpletest_phpunit_xml_to_rows(1, $phpunit_error_xml);
25 $this->assertEquals(count($res), 4, 'All testcases got extracted');
26 $this->assertNotEquals($res[0]['status'], 'pass');
27 $this->assertEquals($res[0]['status'], 'fail');
29 // Test nested testsuites, which appear when you use @dataProvider.
30 for ($i = 0; $i < 3; $i++) {
31 $this->assertNotEquals($res[$i + 1]['status'], 'pass');
32 $this->assertEquals($res[$i + 1]['status'], 'fail');
35 // Make sure simpletest_phpunit_xml_to_rows() does not balk if the test
37 simpletest_phpunit_xml_to_rows(1, 'foobar');