You are here

protected function SimpleTestFunctionalTest::confirmStubTestResults in SimpleTest 7.2

Same name and namespace in other branches
  1. 6.2 simpletest.test \SimpleTestFunctionalTest::confirmStubTestResults()
  2. 7 simpletest.test \SimpleTestFunctionalTest::confirmStubTestResults()

Confirm that the stub test produced the desired results.

1 call to SimpleTestFunctionalTest::confirmStubTestResults()
SimpleTestFunctionalTest::testWebTestRunner in ./simpletest.test
Make sure that tests selected through the web interface are run and that the results are displayed correctly.

File

./simpletest.test, line 189
Tests for simpletest.module.

Class

SimpleTestFunctionalTest
@file Tests for simpletest.module.

Code

protected function confirmStubTestResults() {
  $this
    ->assertAssertion($this->pass, 'Other', 'Pass', 'simpletest.test', 'SimpleTestFunctionalTest->stubTest()');
  $this
    ->assertAssertion($this->fail, 'Other', 'Fail', 'simpletest.test', 'SimpleTestFunctionalTest->stubTest()');
  $this
    ->assertAssertion(t('Created permissions: @perms', array(
    '@perms' => $this->valid_permission,
  )), 'Role', 'Pass', 'simpletest.test', 'SimpleTestFunctionalTest->stubTest()');
  $this
    ->assertAssertion(t('Invalid permission %permission.', array(
    '%permission' => $this->invalid_permission,
  )), 'Role', 'Fail', 'simpletest.test', 'SimpleTestFunctionalTest->stubTest()');

  // Check that a warning is caught by simpletest.
  $this
    ->assertAssertion('Division by zero', 'Warning', 'Fail', 'simpletest.test', 'SimpleTestFunctionalTest->stubTest()');

  // Check that the backtracing code works for specific assert function.
  $this
    ->assertAssertion('This is nothing.', 'Other', 'Pass', 'simpletest.test', 'SimpleTestFunctionalTest->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', 'simpletest.test', 'SimpleTestFunctionalTest->stubTest()');
  $this
    ->assertAssertion("Debug: 'Foo'", 'Debug', 'Fail', 'simpletest.test', 'SimpleTestFunctionalTest->stubTest()');
  $this
    ->assertEqual('6 passes, 2 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.'));
}