Tests the fetchBaseTables() method.
public function testFetchBaseTables() {
// Enabled node module so there is more than 1 base table to test.
$this
->enableModules(array(
'node',
));
$data = $this->viewsData
->get();
$base_tables = $this->viewsData
->fetchBaseTables();
// Test the number of tables returned and their order.
$this
->assertEqual(count($base_tables), 3, 'The correct amount of base tables were returned.');
$this
->assertIdentical(array_keys($base_tables), array(
'node',
'node_field_revision',
'views_test_data',
), 'The tables are sorted as expected.');
// Test the values returned for each base table.
$defaults = array(
'title' => '',
'help' => '',
'weight' => 0,
);
foreach ($base_tables as $base_table => $info) {
// Merge in default values as in fetchBaseTables().
$expected = $data[$base_table]['table']['base'] += $defaults;
foreach ($defaults as $key => $default) {
$this
->assertEqual($info[$key], $expected[$key]);
}
}
}