You are here

public function JUnitConverterTest::testXmlElementToRows in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Test/JUnitConverterTest.php \Drupal\Tests\Core\Test\JUnitConverterTest::testXmlElementToRows()
  2. 9 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 58

Class

JUnitConverterTest
Tests Drupal\Core\Test\JUnitConverter.

Namespace

Drupal\Tests\Core\Test

Code

public function testXmlElementToRows() {
  $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)));
}