function SimpleTestTest::confirmStubTestResults

Confirm that the stub test produced the desired results.

1 call to SimpleTestTest::confirmStubTestResults()
SimpleTestTest::testWebTestRunner in core/modules/simpletest/src/Tests/SimpleTestTest.php
Ensures the tests selected through the web interface are run and displayed.

File

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

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 confirmStubTestResults() {
    $this->assertAssertion(t('Unable to install modules %modules due to missing modules %missing.', [
        '%modules' => 'non_existent_module',
        '%missing' => 'non_existent_module',
    ]), 'Other', 'Fail', 'SimpleTestTest.php', 'Drupal\\simpletest\\Tests\\SimpleTestTest->setUp()');
    $this->assertAssertion($this->passMessage, 'Other', 'Pass', 'SimpleTestTest.php', 'Drupal\\simpletest\\Tests\\SimpleTestTest->stubTest()');
    $this->assertAssertion($this->failMessage, 'Other', 'Fail', 'SimpleTestTest.php', 'Drupal\\simpletest\\Tests\\SimpleTestTest->stubTest()');
    $this->assertAssertion(t('Created permissions: @perms', [
        '@perms' => $this->validPermission,
    ]), 'Role', 'Pass', 'SimpleTestTest.php', 'Drupal\\simpletest\\Tests\\SimpleTestTest->stubTest()');
    $this->assertAssertion(t('Invalid permission %permission.', [
        '%permission' => $this->invalidPermission,
    ]), 'Role', 'Fail', 'SimpleTestTest.php', 'Drupal\\simpletest\\Tests\\SimpleTestTest->stubTest()');
    // Check that the user was logged in successfully.
    $this->assertAssertion('User SimpleTestTest successfully logged in.', 'User login', 'Pass', 'SimpleTestTest.php', 'Drupal\\simpletest\\Tests\\SimpleTestTest->stubTest()');
    // Check that a warning is caught by simpletest. The exact error message
    // differs between PHP versions so only the function name is checked.
    $this->assertAssertion('trigger_error()', 'Warning', 'Fail', 'SimpleTestTest.php', 'Drupal\\simpletest\\Tests\\SimpleTestTest->stubTest()');
    // Check that the backtracing code works for specific assert function.
    $this->assertAssertion('This is nothing.', 'Other', 'Pass', 'SimpleTestTest.php', 'Drupal\\simpletest\\Tests\\SimpleTestTest->stubTest()');
    // Check that errors that occur inside PHP internal functions are correctly
    // reported. The exact error message differs between PHP versions so we
    // check only the function name 'array_key_exists'.
    $this->assertAssertion('array_key_exists', 'Warning', 'Fail', 'SimpleTestTest.php', 'Drupal\\simpletest\\Tests\\SimpleTestTest->stubTest()');
    $this->assertAssertion("Debug: 'Foo'", 'Debug', 'Fail', 'SimpleTestTest.php', 'Drupal\\simpletest\\Tests\\SimpleTestTest->stubTest()');
    $this->assertEqual('16 passes, 3 fails, 2 exceptions, 3 debug messages', $this->childTestResults['summary']);
    $this->testIds[] = $test_id = $this->getTestIdFromResults();
    $this->assertTrue($test_id, 'Found test ID in results.');
}

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