function JUnitConverterTest::testXmlElementToRows

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

@covers ::xmlElementToRows

File

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

Class

JUnitConverterTest
Tests Drupal\Core\Test\JUnitConverter.

Namespace

Drupal\Tests\Core\Test

Code

public function testXmlElementToRows() : void {
    $junit = <<<EOD
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
  <testsuite name="Drupal\\Tests\\simpletest\\Unit\\TestDiscoveryTest" file="/Users/paul/projects/drupal/core/modules/simpletest/tests/src/Unit/TestDiscoveryTest.php" tests="3" assertions="5" errors="0" failures="0" skipped="0" time="0.215539">
    <testcase name="testGetTestClasses" class="Drupal\\Tests\\simpletest\\Unit\\TestDiscoveryTest" classname="Drupal.Tests.simpletest.Unit.TestDiscoveryTest" file="/Users/paul/projects/drupal/core/modules/simpletest/tests/src/Unit/TestDiscoveryTest.php" line="108" assertions="2" time="0.100787"/>
  </testsuite>
</testsuites>
EOD;
    $simpletest = [
        [
            'test_id' => 23,
            'test_class' => 'Drupal\\Tests\\simpletest\\Unit\\TestDiscoveryTest',
            'status' => 'pass',
            'message' => '',
            'message_group' => 'Other',
            'function' => 'Drupal\\Tests\\simpletest\\Unit\\TestDiscoveryTest->testGetTestClasses()',
            'line' => 108,
            'file' => '/Users/paul/projects/drupal/core/modules/simpletest/tests/src/Unit/TestDiscoveryTest.php',
        ],
    ];
    $this->assertEquals($simpletest, JUnitConverter::xmlElementToRows(23, new \SimpleXMLElement($junit)));
}

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