function MemoryTestRunResultsStorageTest::testBuildEnvironmentKeepingExistingResults

Tests build environment keeping existing results.

File

core/tests/Drupal/KernelTests/Core/Test/MemoryTestRunResultsStorageTest.php, line 48

Class

MemoryTestRunResultsStorageTest
Tests Drupal\TestTools\TestRunner\MemoryTestRunResultsStorage.

Namespace

Drupal\KernelTests\Core\Test

Code

public function testBuildEnvironmentKeepingExistingResults() : void {
  // Initial build of the environment.
  $this->testRunResultsStorage
    ->buildTestingResultsEnvironment(FALSE);
  $this->assertEquals(1, $this->testRunResultsStorage
    ->createNew());
  $test_run = TestRun::get($this->testRunResultsStorage, 1);
  $this->assertEquals(1, $this->testRunResultsStorage
    ->insertLogEntry($test_run, $this->getTestLogEntry('Test\\GroundControl')));
  // Build the environment again, keeping results. Results should be kept.
  $this->testRunResultsStorage
    ->buildTestingResultsEnvironment(TRUE);
  $this->assertTrue($this->testRunResultsStorage
    ->validateTestingResultsEnvironment());
  $this->assertEquals(2, $this->testRunResultsStorage
    ->createNew());
  $test_run = TestRun::get($this->testRunResultsStorage, 2);
  $this->assertEquals(2, $this->testRunResultsStorage
    ->insertLogEntry($test_run, $this->getTestLogEntry('Test\\GroundControl')));
  // Cleanup the environment.
  $this->assertEquals(2, $this->testRunResultsStorage
    ->cleanUp());
}

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