diff -u b/modules/simpletest/tests/bootstrap.test b/modules/simpletest/tests/bootstrap.test --- b/modules/simpletest/tests/bootstrap.test +++ b/modules/simpletest/tests/bootstrap.test @@ -414,18 +414,23 @@ // Generate a non-existing module name. $non_existing_module = uniqid("", TRUE); + // We use drupal_static to check if trigger_error has been called. + $get_filename_test_triggered_error = &drupal_static('get_filename_test_triggered_error') + $get_filename_test_triggered_error = FALSE; + // Searching for an item that does not exist returns NULL. // Set a custom error handler so we can ignore the file not found error. set_error_handler(function($severity, $message, $file, $line) { // Skip error handling if this is a "file not found" error. if (strstr($message, 'is missing from the file system:')) { - cache_set('get_filename_test_triggered_error', TRUE); + $get_filename_test_triggered_error = &drupal_static('get_filename_test_triggered_error') + $get_filename_test_triggered_error = TRUE; return; } throw new \ErrorException($message, 0, $severity, $file, $line); }); $this->assertNull(drupal_get_filename('module', $non_existing_module), 'Searching for an item that does not exist returns NULL.'); - $this->assertTrue(cache_get('get_filename_test_triggered_error'), 'Searching for an item that does not exist triggers an error.'); + $this->assertTrue($get_filename_test_triggered_error, 'Searching for an item that does not exist triggers an error.'); // Restore the original error handler. restore_error_handler(); $this->assertNull(drupal_get_filename('module', $non_existing_module), 'Searching for an item that does not exist returns NULL.'); @@ -434,7 +439,7 @@ $bad = &drupal_static('drupal_get_filename:missing'); // Searching for an item that does not exist creates a static record in drupal_get_filename. - $this->assertTrue($missing['module'][$non_existing_module], 'Searching for an item that does not exist creates a static record in drupal_get_filename.'); + $this->assertTrue($bad['module'][$non_existing_module], 'Searching for an item that does not exist creates a static record in drupal_get_filename.'); } }