Commit 88350da6 authored by alexpott's avatar alexpott

Revert "Issue #2144669 by Mile23, Nitesh Sethia: Improve/Refactor TestBase...

Revert "Issue #2144669 by Mile23, Nitesh Sethia: Improve/Refactor TestBase Through Expanded Unit Testing"

This reverts commit 921317dc.
parent 921317dc
......@@ -9,8 +9,8 @@
use Drupal\Component\Utility\Crypt;
use Drupal\Component\Utility\Random;
use Drupal\Component\Utility\String;
use Drupal\Core\Database\Database;
use Drupal\Component\Utility\String;
use Drupal\Core\Config\ConfigImporter;
use Drupal\Core\Config\StorageComparer;
use Drupal\Core\DependencyInjection\ContainerBuilder;
......@@ -343,23 +343,6 @@ protected function checkRequirements() {
return array();
}
/**
* Helper method to store an assertion record in the configured database.
*
* This method decouples database access from assertion logic.
*
* @param array $assertion
* Keyed array representing an assertion, as generated by assert().
*
* @see self::assert()
*/
protected function storeAssertion(array $assertion) {
return self::getDatabaseConnection()
->insert('simpletest')
->fields($assertion)
->execute();
}
/**
* Internal helper: stores the assert.
*
......@@ -410,7 +393,10 @@ protected function assert($status, $message = '', $group = 'Other', array $calle
);
// Store assertion for display after the test has completed.
$this->storeAssertion($assertion);
self::getDatabaseConnection()
->insert('simpletest')
->fields($assertion)
->execute();
// We do not use a ternary operator here to allow a breakpoint on
// test failure.
......@@ -464,7 +450,6 @@ public static function insertAssert($test_id, $test_class, $status, $message = '
'file' => $caller['file'],
);
// We can't use storeAssertion() because this method is static.
return self::getDatabaseConnection()
->insert('simpletest')
->fields($assertion)
......@@ -483,7 +468,6 @@ public static function insertAssert($test_id, $test_class, $status, $message = '
* @see \Drupal\simpletest\TestBase::insertAssert()
*/
public static function deleteAssert($message_id) {
// We can't use storeAssertion() because this method is static.
return (bool) self::getDatabaseConnection()
->delete('simpletest')
->condition('message_id', $message_id)
......@@ -1350,6 +1334,7 @@ private function restoreEnvironment() {
*/
public function errorHandler($severity, $message, $file = NULL, $line = NULL) {
if ($severity & error_reporting()) {
require_once DRUPAL_ROOT . '/core/includes/errors.inc';
$error_map = array(
E_STRICT => 'Run-time notice',
E_WARNING => 'Warning',
......@@ -1384,6 +1369,7 @@ public function errorHandler($severity, $message, $file = NULL, $line = NULL) {
* @see set_exception_handler
*/
protected function exceptionHandler($exception) {
require_once DRUPAL_ROOT . '/core/includes/errors.inc';
$backtrace = $exception->getTrace();
$verbose_backtrace = $backtrace;
// Push on top of the backtrace the call that generated the exception.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment