You are here

public function SimpletestDeprecationTest::testDeprecatedPhpUnitFunctions in SimpleTest 8.3

@expectedDeprecation simpletest_phpunit_xml_filepath is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Test\PhpUnitTestRunner::xmlLogFilepath() instead. See https://www.drupal.org/node/2948547 @expectedDeprecation simpletest_phpunit_command is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Test\PhpUnitTestRunner::phpUnitCommand() instead. See https://www.drupal.org/node/2948547 @expectedDeprecation simpletest_phpunit_find_testcases is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Test\JUnitConverter::findTestCases() instead. See https://www.drupal.org/node/2948547 @expectedDeprecation simpletest_phpunit_testcase_to_row is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Test\JUnitConverter::convertTestCaseToSimpletestRow() instead. See https://www.drupal.org/node/2948547 @expectedDeprecation simpletest_summarize_phpunit_result is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Test\PhpUnitTestRunner::summarizeResults() instead. See https://www.drupal.org/node/2948547

File

tests/src/Kernel/SimpletestDeprecationTest.php, line 44

Class

SimpletestDeprecationTest
Verify deprecations within the simpletest module.

Namespace

Drupal\Tests\simpletest\Kernel

Code

public function testDeprecatedPhpUnitFunctions() {

  // We can't test the deprecation errors for the following functions because
  // they cannot be mocked, and calling them would change the test results:
  // - simpletest_run_phpunit_tests().
  // - simpletest_phpunit_run_command().
  // - simpletest_phpunit_xml_to_rows().
  $this
    ->assertStringEndsWith('/phpunit-23.xml', simpletest_phpunit_xml_filepath(23));
  $this
    ->assertInternalType('string', simpletest_phpunit_command());
  $this
    ->assertEquals([], simpletest_phpunit_find_testcases(new \SimpleXMLElement('<not_testcase></not_testcase>')));
  $this
    ->assertEquals([
    'test_id' => 23,
    'test_class' => '',
    'status' => 'pass',
    'message' => '',
    'message_group' => 'Other',
    'function' => '->()',
    'line' => 0,
    'file' => NULL,
  ], simpletest_phpunit_testcase_to_row(23, new \SimpleXMLElement('<not_testcase></not_testcase>')));
  $this
    ->assertEquals([
    static::class => [
      '#pass' => 0,
      '#fail' => 0,
      '#exception' => 0,
      '#debug' => 1,
    ],
  ], simpletest_summarize_phpunit_result([
    [
      'test_class' => static::class,
      'status' => 'debug',
    ],
  ]));
}