function JUnitConverterTest::testXmlToRowsWithErrors

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Test/JUnitConverterTest.php \Drupal\Tests\Core\Test\JUnitConverterTest::testXmlToRowsWithErrors()
  2. 10 core/tests/Drupal/Tests/Core/Test/JUnitConverterTest.php \Drupal\Tests\Core\Test\JUnitConverterTest::testXmlToRowsWithErrors()
  3. 11.x core/tests/Drupal/Tests/Core/Test/JUnitConverterTest.php \Drupal\Tests\Core\Test\JUnitConverterTest::testXmlToRowsWithErrors()

Test errors reported. @covers ::xmlToRows

File

core/tests/Drupal/Tests/Core/Test/JUnitConverterTest.php, line 28

Class

JUnitConverterTest
Tests <a href="/api/drupal/core%21lib%21Drupal%21Core%21Test%21JUnitConverter.php/class/JUnitConverter/8.9.x" title="Converts JUnit XML to Drupal&#039;s {simpletest} schema." class="local">Drupal\Core\Test\JUnitConverter</a>.

Namespace

Drupal\Tests\Core\Test

Code

public function testXmlToRowsWithErrors() {
    $phpunit_error_xml = __DIR__ . '/fixtures/phpunit_error.xml';
    $res = JUnitConverter::xmlToRows(1, $phpunit_error_xml);
    $this->assertCount(4, $res, 'All testcases got extracted');
    $this->assertNotEquals($res[0]['status'], 'pass');
    $this->assertEquals($res[0]['status'], 'fail');
    // Test nested testsuites, which appear when you use @dataProvider.
    for ($i = 0; $i < 3; $i++) {
        $this->assertNotEquals($res[$i + 1]['status'], 'pass');
        $this->assertEquals($res[$i + 1]['status'], 'fail');
    }
    // Make sure xmlToRows() does not balk if there are no test results.
    $this->assertSame([], JUnitConverter::xmlToRows(1, 'does_not_exist'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.