1 simpletest.test SimpleTestFunctionalTest::confirmStubTestResults()

Confirm that the stub test produced the desired results.

File

core/modules/simpletest/tests/simpletest.test, line 177
Tests for simpletest.module.

Class

SimpleTestFunctionalTest

Code

function confirmStubTestResults() {
  $this->assertAssertion(t('Enabled modules: %modules', array('%modules' => 'non_existent_module')), 'Other', 'Fail', 'simpletest.test', 'SimpleTestFunctionalTest->setUp()');

  $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->assertTrue(strpos($this->childTestResults['summary'], '6 passes, 5 fails, 2 exceptions, and 1 debug message.') === 0, 'Stub test summary is correct');

  $this->test_ids[] = $test_id = $this->getTestIdFromResults();
  $this->assertTrue($test_id, 'Found test ID in results.');
}