function DatabaseTestCase::installTables in SimpleTest 7
Set up several tables needed by a certain test.
Parameters
$schema: An array of table definitions to install.
2 calls to DatabaseTestCase::installTables()
- DatabaseTestCase::ensureSampleDataNull in tests/
database_test.test - Set up tables for NULL handling.
- DatabaseTestCase::setUp in tests/
database_test.test - Generates a random database prefix, runs the install scripts on the prefixed database and enable the specified modules. After installation many caches are flushed and the internal browser is setup so that the page requests will run on the new prefix.…
File
- tests/
database_test.test, line 40
Class
- DatabaseTestCase
- Base test class for databases.
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), t('Table @name created successfully.', array(
'@name' => $name,
)));
}
}