function SimpletestTestRunResultsStorageTest::testGetCurrentTestRunState
Same name in other branches
- 11.x core/tests/Drupal/KernelTests/Core/Test/SimpletestTestRunResultsStorageTest.php \Drupal\KernelTests\Core\Test\SimpletestTestRunResultsStorageTest::testGetCurrentTestRunState()
@covers ::buildTestingResultsEnvironment @covers ::createNew @covers ::insertLogEntry @covers ::setDatabasePrefix @covers ::removeResults
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Test/ SimpletestTestRunResultsStorageTest.php, line 108
Class
- SimpletestTestRunResultsStorageTest
- @coversDefaultClass \Drupal\Core\Test\SimpletestTestRunResultsStorage @group Test
Namespace
Drupal\KernelTests\Core\TestCode
public function testGetCurrentTestRunState() : void {
$this->testRunResultsStorage
->buildTestingResultsEnvironment(FALSE);
$this->assertEquals(1, $this->testRunResultsStorage
->createNew());
$test_run_1 = TestRun::get($this->testRunResultsStorage, 1);
$this->testRunResultsStorage
->setDatabasePrefix($test_run_1, 'oddity1234');
$this->assertEquals(1, $this->testRunResultsStorage
->insertLogEntry($test_run_1, $this->getTestLogEntry('Test\\GroundControl')));
$this->assertEquals([
'db_prefix' => 'oddity1234',
'test_class' => 'Test\\GroundControl',
], $this->testRunResultsStorage
->getCurrentTestRunState($test_run_1));
// Add another test run.
$this->assertEquals(2, $this->testRunResultsStorage
->createNew());
$test_run_2 = TestRun::get($this->testRunResultsStorage, 2);
$this->assertEquals(2, $this->testRunResultsStorage
->insertLogEntry($test_run_2, $this->getTestLogEntry('Test\\GroundControl')));
// Remove test run 1 results.
$this->assertEquals(1, $this->testRunResultsStorage
->removeResults($test_run_1));
$this->assertEquals(1, $this->connection
->select('simpletest')
->countQuery()
->execute()
->fetchField());
$this->assertEquals(1, $this->connection
->select('simpletest_test_id')
->countQuery()
->execute()
->fetchField());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.