function PhpUnitErrorTest::testPhpUnitXmlParsing

Test errors reported.

@expectedDeprecation simpletest_phpunit_xml_to_rows is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Test\JUnitConverter::xmlToRows() instead. See https://www.drupal.org/node/2948547

File

core/modules/simpletest/tests/src/Kernel/PhpUnitErrorTest.php, line 27

Class

PhpUnitErrorTest
Tests PHPUnit errors are getting converted to Simpletest errors.

Namespace

Drupal\Tests\simpletest\Kernel

Code

public function testPhpUnitXmlParsing() {
    $phpunit_error_xml = __DIR__ . '/../../fixtures/phpunit_error.xml';
    $res = simpletest_phpunit_xml_to_rows(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 simpletest_phpunit_xml_to_rows() does not balk if the test
    // didn't run.
    $this->assertNull(simpletest_phpunit_xml_to_rows(1, 'does_not_exist'));
}

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