You are here

protected function DrupalCloneTestCase::cloneTable in SimpleTest 7.2

Clone an existing table structure and data.

Parameters

$name: Table name.

$source: Source table name.

$schema: A Schema API definition array.

1 call to DrupalCloneTestCase::cloneTable()
DrupalCloneTestCase::setUpInstall in ./drupal_web_test_case.php
Perform Drupal installation.

File

./drupal_web_test_case.php, line 3484
Provides DrupalTestCase, DrupalUnitTestCase, and DrupalWebTestCase classes.

Class

DrupalCloneTestCase
Clone an existing database and use it for testing.

Code

protected function cloneTable($name, $source, $schema) {
  db_create_table($name, $schema);
  $target = Database::getConnection()
    ->prefixTables('{' . $name . '}');
  if (!in_array($name, $this->excludeTables)) {
    db_query('INSERT INTO ' . $target . ' SELECT * FROM ' . $source);
  }
}