From ff9b00981e6526b75a9884b1d889eb0d3e2d0347 Mon Sep 17 00:00:00 2001
From: sun <sun@unleashedmind.com>
Date: Fri, 8 Aug 2014 21:53:28 +0200
Subject: [PATCH] Temporarily use SQLite in Database KTB tests to expose
 errors.

---
 .../system/src/Tests/Database/DatabaseTestBase.php | 28 ++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/core/modules/system/src/Tests/Database/DatabaseTestBase.php b/core/modules/system/src/Tests/Database/DatabaseTestBase.php
index da14f5c..e3952e5 100644
--- a/core/modules/system/src/Tests/Database/DatabaseTestBase.php
+++ b/core/modules/system/src/Tests/Database/DatabaseTestBase.php
@@ -7,6 +7,7 @@
 
 namespace Drupal\system\Tests\Database;
 
+use Drupal\Core\Database\Database;
 use Drupal\simpletest\DrupalUnitTestBase;
 
 /**
@@ -19,8 +20,29 @@
 
   public static $modules = array('database_test');
 
+  /**
+   * @var string
+   */
+  protected $sqliteDb;
+
   function setUp() {
     parent::setUp();
+
+    Database::removeConnection('default');
+    $this->container->set('database', NULL);
+    $this->sqliteDb = tempnam(sys_get_temp_dir(), 'test-sqlite');
+    Database::addConnectionInfo('default', 'default', array(
+      'driver' => 'sqlite',
+      'namespace' => 'Drupal\Core\Database\Driver\sqlite',
+      'host' => '',
+      'database' => $this->sqliteDb,
+      'username' => '',
+      'password' => '',
+      'prefix' => array(
+        'default' => '',
+      ),
+    ));
+
     $this->installSchema('database_test', array(
       'test',
       'test_people',
@@ -34,6 +56,12 @@ function setUp() {
     self::addSampleData();
   }
 
+  protected function tearDown() {
+    parent::tearDown();
+    @unlink($this->sqliteDb);
+    unset($this->sqliteDb);
+  }
+
   /**
    * Sets up tables for NULL handling.
    */
-- 
1.7.11.msysgit.1

