function TestRunTest::testGetLogEntriesByTestClass

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/KernelTests/Core/Test/TestRunTest.php \Drupal\KernelTests\Core\Test\TestRunTest::testGetLogEntriesByTestClass()
  2. 10 core/tests/Drupal/KernelTests/Core/Test/TestRunTest.php \Drupal\KernelTests\Core\Test\TestRunTest::testGetLogEntriesByTestClass()

Tests get log entries by test class.

File

core/tests/Drupal/KernelTests/Core/Test/TestRunTest.php, line 106

Class

TestRunTest
Tests Drupal\Core\Test\TestRun.

Namespace

Drupal\KernelTests\Core\Test

Code

public function testGetLogEntriesByTestClass() : void {
  $test_run = TestRun::createNew($this->testRunResultsStorage);
  $test_run->setDatabasePrefix('oddity1234');
  $this->assertEquals(1, $test_run->insertLogEntry($this->getTestLogEntry('Test\\PlanetEarth')));
  $this->assertEquals(2, $test_run->insertLogEntry($this->getTestLogEntry('Test\\GroundControl')));
  $this->assertEquals([
    0 => (object) [
      'message_id' => '2',
      'test_id' => '1',
      'test_class' => 'Test\\GroundControl',
      'status' => 'pass',
      'message' => 'Major Tom',
      'message_group' => 'other',
      'function' => 'Unknown',
      'line' => '0',
      'file' => 'Unknown',
      'time' => '0',
      'exit_code' => '0',
    ],
    1 => (object) [
      'message_id' => '1',
      'test_id' => '1',
      'test_class' => 'Test\\PlanetEarth',
      'status' => 'pass',
      'message' => 'Major Tom',
      'message_group' => 'other',
      'function' => 'Unknown',
      'line' => '0',
      'file' => 'Unknown',
      'time' => '0',
      'exit_code' => '0',
    ],
  ], $test_run->getLogEntriesByTestClass());
  $this->assertEquals('oddity1234', $test_run->getDatabasePrefix());
  $this->assertEquals('Test\\GroundControl', $test_run->getTestClass());
}

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