diff --git a/core/modules/system/lib/Drupal/system/Tests/Database/DatabaseTestBase.php b/core/modules/system/lib/Drupal/system/Tests/Database/DatabaseTestBase.php
index 977dc8d..6d3b458 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Database/DatabaseTestBase.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Database/DatabaseTestBase.php
@@ -7,64 +7,26 @@
 
 namespace Drupal\system\Tests\Database;
 
-use Drupal\simpletest\WebTestBase;
+use Drupal\simpletest\DrupalUnitTestBase;
 
 /**
- * Tests for databases.
+ * Base class for databases database tests.
  *
  * Because all database tests share the same test data, we can centralize that
  * here.
  */
-abstract class DatabaseTestBase extends WebTestBase {
-
-  /**
-   * Modules to enable.
-   *
-   * @var array
-   */
-  public static $modules = array('database_test');
+abstract class DatabaseTestBase extends DrupalUnitTestBase {
 
   function setUp() {
     parent::setUp();
-
-    $schema['test'] = drupal_get_schema('test');
-    $schema['test_people'] = drupal_get_schema('test_people');
-    $schema['test_one_blob'] = drupal_get_schema('test_one_blob');
-    $schema['test_two_blobs'] = drupal_get_schema('test_two_blobs');
-    $schema['test_task'] = drupal_get_schema('test_task');
-
-    $this->installTables($schema);
-
-    $this->addSampleData();
-  }
-
-  /**
-   * Sets up several tables needed by a certain test.
-   *
-   * @param $schema
-   *   An array of table definitions to install.
-   */
-  function installTables($schema) {
-    // This ends up being a test for table drop and create, too, which is nice.
-    foreach ($schema as $name => $data) {
-      if (db_table_exists($name)) {
-        db_drop_table($name);
-      }
-      db_create_table($name, $data);
-    }
-
-    foreach ($schema as $name => $data) {
-      $this->assertTrue(db_table_exists($name), format_string('Table @name created successfully.', array('@name' => $name)));
-    }
+    $this->enableModules(array('database_test'));
+    self::addSampleData();
   }
 
   /**
    * Sets up tables for NULL handling.
    */
   function ensureSampleDataNull() {
-    $schema['test_null'] = drupal_get_schema('test_null');
-    $this->installTables($schema);
-
     db_insert('test_null')
     ->fields(array('name', 'age'))
     ->values(array(
@@ -84,11 +46,8 @@ function ensureSampleDataNull() {
 
   /**
    * Sets up our sample data.
-   *
-   * These are added using db_query(), since we're not trying to test the
-   * INSERT operations here, just populate.
    */
-  function addSampleData() {
+  static function addSampleData() {
     // We need the IDs, so we can't use a multi-insert here.
     $john = db_insert('test')
       ->fields(array(
diff --git a/core/modules/system/lib/Drupal/system/Tests/Database/DatabaseWebTestBase.php b/core/modules/system/lib/Drupal/system/Tests/Database/DatabaseWebTestBase.php
new file mode 100644
index 0000000..badda2c
--- /dev/null
+++ b/core/modules/system/lib/Drupal/system/Tests/Database/DatabaseWebTestBase.php
@@ -0,0 +1,29 @@
+<?php
+
+/**
+ * @file
+ * Definition of Drupal\system\Tests\Database\DatabaseWebTestBase.
+ */
+
+namespace Drupal\system\Tests\Database;
+
+use Drupal\simpletest\WebTestBase;
+
+/**
+ * Base class for databases database tests.
+ */
+abstract class DatabaseWebTestBase extends WebTestBase {
+
+  /**
+   * Modules to enable.
+   *
+   * @var array
+   */
+  public static $modules = array('database_test');
+
+  function setUp() {
+    parent::setUp();
+
+    DatabaseTestBase::addSampleData();
+  }
+}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Database/EmptyStatementTest.php b/core/modules/system/lib/Drupal/system/Tests/Database/EmptyStatementTest.php
index 6d4756a..636bd31 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Database/EmptyStatementTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Database/EmptyStatementTest.php
@@ -9,12 +9,12 @@
 
 use Drupal\Core\Database\StatementEmpty;
 use Drupal\Core\Database\StatementInterface;
-use Drupal\simpletest\WebTestBase;
+use Drupal\simpletest\UnitTestBase;
 
 /**
  * Tests the empty pseudo-statement class.
  */
-class EmptyStatementTest extends WebTestBase {
+class EmptyStatementTest extends UnitTestBase {
   public static function getInfo() {
     return array(
       'name' => 'Empty statement',
diff --git a/core/modules/system/lib/Drupal/system/Tests/Database/NextIdTest.php b/core/modules/system/lib/Drupal/system/Tests/Database/NextIdTest.php
index 1dd92eb..23205fb 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Database/NextIdTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Database/NextIdTest.php
@@ -7,12 +7,19 @@
 
 namespace Drupal\system\Tests\Database;
 
-use Drupal\simpletest\WebTestBase;
+use Drupal\simpletest\DrupalUnitTestBase;
 
 /**
  * Checks the sequences API.
  */
-class NextIdTest extends WebTestBase {
+class NextIdTest extends DrupalUnitTestBase {
+
+  /**
+   * The modules to enable.
+   * @var array
+   */
+  public static $modules = array('system');
+
   public static function getInfo() {
     return array(
       'name' => 'Sequences API',
@@ -21,6 +28,11 @@ public static function getInfo() {
     );
   }
 
+  public function setUp() {
+    parent::setUp();
+    $this->installSchema('system', 'sequences');
+  }
+
   /**
    * Tests that the sequences API works.
    */
diff --git a/core/modules/system/lib/Drupal/system/Tests/Database/RegressionTest.php b/core/modules/system/lib/Drupal/system/Tests/Database/RegressionTest.php
index 4e4f364..f38b49f 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Database/RegressionTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Database/RegressionTest.php
@@ -48,7 +48,7 @@ function testRegression_310447() {
    * Tests the db_table_exists() function.
    */
   function testDBTableExists() {
-    $this->assertIdentical(TRUE, db_table_exists('node'), 'Returns true for existent table.');
+    $this->assertIdentical(TRUE, db_table_exists('test'), 'Returns true for existent table.');
     $this->assertIdentical(FALSE, db_table_exists('nosuchtable'), 'Returns false for nonexistent table.');
   }
 
@@ -56,15 +56,15 @@ function testDBTableExists() {
    * Tests the db_field_exists() function.
    */
   function testDBFieldExists() {
-    $this->assertIdentical(TRUE, db_field_exists('node', 'nid'), 'Returns true for existent column.');
-    $this->assertIdentical(FALSE, db_field_exists('node', 'nosuchcolumn'), 'Returns false for nonexistent column.');
+    $this->assertIdentical(TRUE, db_field_exists('test', 'name'), 'Returns true for existent column.');
+    $this->assertIdentical(FALSE, db_field_exists('test', 'nosuchcolumn'), 'Returns false for nonexistent column.');
   }
 
   /**
    * Tests the db_index_exists() function.
    */
   function testDBIndexExists() {
-    $this->assertIdentical(TRUE, db_index_exists('node', 'node_created'), 'Returns true for existent index.');
-    $this->assertIdentical(FALSE, db_index_exists('node', 'nosuchindex'), 'Returns false for nonexistent index.');
+    $this->assertIdentical(TRUE, db_index_exists('test', 'ages'), 'Returns true for existent index.');
+    $this->assertIdentical(FALSE, db_index_exists('test', 'nosuchindex'), 'Returns false for nonexistent index.');
   }
 }
diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/SchemaTest.php b/core/modules/system/lib/Drupal/system/Tests/Database/SchemaTest.php
similarity index 98%
rename from core/modules/system/lib/Drupal/system/Tests/Common/SchemaTest.php
rename to core/modules/system/lib/Drupal/system/Tests/Database/SchemaTest.php
index 7c328b4..fb4d2a1 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Common/SchemaTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Database/SchemaTest.php
@@ -2,20 +2,20 @@
 
 /**
  * @file
- * Definition of Drupal\system\Tests\Common\SchemaTest.
+ * Contains Drupal\system\Tests\Database\SchemaTest.
  */
 
-namespace Drupal\system\Tests\Common;
+namespace Drupal\system\Tests\Database;
 
 use Drupal\Core\Database\Database;
-use Drupal\simpletest\WebTestBase;
+use Drupal\simpletest\UnitTestBase;
 
 use Exception;
 
 /**
  * Tests the Schema API.
  */
-class SchemaTest extends WebTestBase {
+class SchemaTest extends UnitTestBase {
 
   /**
    * A global counter for table and field creation.
diff --git a/core/modules/system/lib/Drupal/system/Tests/Database/SelectComplexTest.php b/core/modules/system/lib/Drupal/system/Tests/Database/SelectComplexTest.php
index 643b036..5ad4faa 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Database/SelectComplexTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Database/SelectComplexTest.php
@@ -337,8 +337,14 @@ function testJoinTwice() {
    * Tests that we can join on a query.
    */
   function testJoinSubquery() {
-    $acct = $this->drupalCreateUser();
-    $this->drupalLogin($acct);
+    $this->enableModules(array('system'), FALSE);
+    $this->installSchema('system', 'sequences');
+    $this->enableModules(array('field', 'user'));
+
+    $account = entity_create('user', array(
+      'name' => $this->randomName(),
+      'mail' => $this->randomName() . '@example.com',
+    ));
 
     $query = db_select('test_task', 'tt', array('target' => 'slave'));
     $query->addExpression('tt.pid + 1', 'abc');
@@ -349,7 +355,7 @@ function testJoinSubquery() {
     $subquery->join('test_one_blob', 'tpb', 'tp.id = tpb.id');
     $subquery->join('node', 'n', 'tp.id = n.nid');
     $subquery->addTag('node_access');
-    $subquery->addMetaData('account', $acct);
+    $subquery->addMetaData('account', $account);
     $subquery->addField('tp', 'id');
     $subquery->condition('age', 5, '>');
     $subquery->condition('age', 500, '<');
diff --git a/core/modules/system/lib/Drupal/system/Tests/Database/SelectPagerDefaultTest.php b/core/modules/system/lib/Drupal/system/Tests/Database/SelectPagerDefaultTest.php
index a8c3daf..83f0640 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Database/SelectPagerDefaultTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Database/SelectPagerDefaultTest.php
@@ -10,7 +10,7 @@
 /**
  * Tests the pager query select extender.
  */
-class SelectPagerDefaultTest extends DatabaseTestBase {
+class SelectPagerDefaultTest extends DatabaseWebTestBase {
 
   public static function getInfo() {
     return array(
diff --git a/core/modules/system/lib/Drupal/system/Tests/Database/SelectTableSortDefaultTest.php b/core/modules/system/lib/Drupal/system/Tests/Database/SelectTableSortDefaultTest.php
index c740292..200a82a 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Database/SelectTableSortDefaultTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Database/SelectTableSortDefaultTest.php
@@ -10,7 +10,7 @@
 /**
  * Tests the tablesort query extender.
  */
-class SelectTableSortDefaultTest extends DatabaseTestBase {
+class SelectTableSortDefaultTest extends DatabaseWebTestBase {
 
   public static function getInfo() {
     return array(
diff --git a/core/modules/system/lib/Drupal/system/Tests/Database/TemporaryQueryTest.php b/core/modules/system/lib/Drupal/system/Tests/Database/TemporaryQueryTest.php
index 529e218..ea61cd9 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Database/TemporaryQueryTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Database/TemporaryQueryTest.php
@@ -10,7 +10,7 @@
 /**
  * Tests temporary queries.
  */
-class TemporaryQueryTest extends DatabaseTestBase {
+class TemporaryQueryTest extends DatabaseWebTestBase {
 
   /**
    * Modules to enable.
