function SimpleTestTest::confirmStubTestResults

Confirm that the stub test produced the desired results.

1 call to SimpleTestTest::confirmStubTestResults()
SimpleTestTest::testWebTestRunner in drupal/core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestTest.php
Make sure that tests selected through the web interface are run and that the results are displayed correctly.

File

drupal/core/modules/simpletest/lib/Drupal/simpletest/Tests/SimpleTestTest.php, line 206
Definition of Drupal\simpletest\Tests\SimpleTestTest.

Class

SimpleTestTest

Namespace

Drupal\simpletest\Tests

Code

function confirmStubTestResults() {
  $this
    ->assertAssertion(t('Enabled modules: %modules', array(
    '%modules' => 'non_existent_module',
  )), 'Other', 'Fail', 'SimpleTestTest.php', 'Drupal\\simpletest\\Tests\\SimpleTestTest->setUp()');
  $this
    ->assertAssertion($this->pass, 'Other', 'Pass', 'SimpleTestTest.php', 'Drupal\\simpletest\\Tests\\SimpleTestTest->stubTest()');
  $this
    ->assertAssertion($this->fail, 'Other', 'Fail', 'SimpleTestTest.php', 'Drupal\\simpletest\\Tests\\SimpleTestTest->stubTest()');
  $this
    ->assertAssertion(t('Created permissions: @perms', array(
    '@perms' => $this->valid_permission,
  )), 'Role', 'Pass', 'SimpleTestTest.php', 'Drupal\\simpletest\\Tests\\SimpleTestTest->stubTest()');
  $this
    ->assertAssertion(t('Invalid permission %permission.', array(
    '%permission' => $this->invalid_permission,
  )), 'Role', 'Fail', 'SimpleTestTest.php', 'Drupal\\simpletest\\Tests\\SimpleTestTest->stubTest()');

  // Check that a warning is caught by simpletest.
  $this
    ->assertAssertion('Division by zero', '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('6 passes, 5 fails, 2 exceptions, and 1 debug message', $this->childTestResults['summary'], 'Stub test summary is correct');
  $this->test_ids[] = $test_id = $this
    ->getTestIdFromResults();
  $this
    ->assertTrue($test_id, t('Found test ID in results.'));
}