You are here

function SimpleTestTest::testWebTestRunner in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/simpletest/src/Tests/SimpleTestTest.php \Drupal\simpletest\Tests\SimpleTestTest::testWebTestRunner()

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

File

core/modules/simpletest/src/Tests/SimpleTestTest.php, line 117
Contains \Drupal\simpletest\Tests\SimpleTestTest.

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

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 = array();
      $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.');
  }
}