function SimpletestTestRunResultsStorageTest::testGetLogEntriesByTestClass

Same name in other branches
  1. 10 core/tests/Drupal/KernelTests/Core/Test/SimpletestTestRunResultsStorageTest.php \Drupal\KernelTests\Core\Test\SimpletestTestRunResultsStorageTest::testGetLogEntriesByTestClass()

@covers ::buildTestingResultsEnvironment @covers ::createNew @covers ::insertLogEntry @covers ::setDatabasePrefix @covers ::getLogEntriesByTestClass

File

core/tests/Drupal/KernelTests/Core/Test/SimpletestTestRunResultsStorageTest.php, line 138

Class

SimpletestTestRunResultsStorageTest
@coversDefaultClass \Drupal\Core\Test\SimpletestTestRunResultsStorage @group Test

Namespace

Drupal\KernelTests\Core\Test

Code

public function testGetLogEntriesByTestClass() : void {
    $this->testRunResultsStorage
        ->buildTestingResultsEnvironment(FALSE);
    $this->assertEquals(1, $this->testRunResultsStorage
        ->createNew());
    $test_run = TestRun::get($this->testRunResultsStorage, 1);
    $this->testRunResultsStorage
        ->setDatabasePrefix($test_run, 'oddity1234');
    $this->assertEquals(1, $this->testRunResultsStorage
        ->insertLogEntry($test_run, $this->getTestLogEntry('Test\\PlanetEarth')));
    $this->assertEquals(2, $this->testRunResultsStorage
        ->insertLogEntry($test_run, $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',
        ],
        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',
        ],
    ], $this->testRunResultsStorage
        ->getLogEntriesByTestClass($test_run));
}

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