1 simpletest.test | SimpleTestFunctionalTest::confirmStubTestResults() |
Confirm that the stub test produced the desired results.
File
- core/
modules/ simpletest/ tests/ simpletest.test, line 200 - Tests for simpletest.module.
Class
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.
// The exact error message differs between PHP versions so we check only
// the presence of the 'foreach' statement.
$this->assertAssertion('foreach()', '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 'simplexml_load_string'.
$this->assertAssertion('simplexml_load_string', 'Warning', 'Fail', 'simpletest.test', 'SimpleTestFunctionalTest->stubTest()');
// Some PHP versions create 3 exceptions in simplexml_load_string(), while
// others only create 1. So we may have 4 or 2 exceptions in total.
$acceptable_results = array(
'6 passes, 5 fails, 4 exceptions, and 1 debug message.',
'6 passes, 5 fails, 2 exceptions, and 1 debug message.',
);
$summary_correct = in_array($this->childTestResults['summary'], $acceptable_results);
$this->assertTrue($summary_correct, 'Stub test summary is correct');
$this->assertAssertion("Debug: 'Foo'", 'Debug', 'Fail', 'simpletest.test', 'SimpleTestFunctionalTest->stubTest()');
$this->test_ids[] = $test_id = $this->getTestIdFromResults();
$this->assertTrue($test_id, 'Found test ID in results.');
}