function SimpleTestTest::testWebTestRunner

Ensures the tests selected through the web interface are run and displayed.

File

core/modules/simpletest/src/Tests/SimpleTestTest.php, line 116

Class

SimpleTestTest
Tests SimpleTest's web interface: check that the intended tests were run and ensure that test reports display the intended results. Also test SimpleTest's internal browser and APIs implicitly.

Namespace

Drupal\simpletest\Tests

Code

public function testWebTestRunner() {
    $this->passMessage = t('SimpleTest pass.');
    $this->failMessage = t('SimpleTest fail.');
    $this->validPermission = 'access administration pages';
    $this->invalidPermission = 'invalid permission';
    if ($this->isInChildSite()) {
        // Only run following code if this test is running itself through a CURL
        // request.
        $this->stubTest();
    }
    else {
        // Run twice so test_ids can be accumulated.
        for ($i = 0; $i < 2; $i++) {
            // Run this test from web interface.
            $this->drupalGet('admin/config/development/testing');
            $edit = [];
            $edit['tests[Drupal\\simpletest\\Tests\\SimpleTestTest]'] = TRUE;
            $this->drupalPostForm(NULL, $edit, t('Run tests'));
            // Parse results and confirm that they are correct.
            $this->getTestResults();
            $this->confirmStubTestResults();
        }
        // Regression test for #290316.
        // Check that test_id is incrementing.
        $this->assertTrue($this->testIds[0] != $this->testIds[1], 'Test ID is incrementing.');
    }
}

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