function DatabaseTestBase::installTables

Sets up several tables needed by a certain test.

Parameters

$schema: An array of table definitions to install.

2 calls to DatabaseTestBase::installTables()
DatabaseTestBase::ensureSampleDataNull in drupal/core/modules/system/lib/Drupal/system/Tests/Database/DatabaseTestBase.php
Sets up tables for NULL handling.
DatabaseTestBase::setUp in drupal/core/modules/system/lib/Drupal/system/Tests/Database/DatabaseTestBase.php
Sets up a Drupal site for running functional and integration tests.

File

drupal/core/modules/system/lib/Drupal/system/Tests/Database/DatabaseTestBase.php, line 47
Definition of Drupal\system\Tests\Database\DatabaseTestBase.

Class

DatabaseTestBase
Tests for databases.

Namespace

Drupal\system\Tests\Database

Code

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,
    )));
  }
}