Tests all things related to the query.
public function testQuery() {
// Tests adding additional fields to the query.
$view = views_get_view('test_view');
$view
->initHandlers();
$id_field = $view->field['id'];
$id_field->additional_fields['job'] = 'job';
// Choose also a field alias key which doesn't match to the table field.
$id_field->additional_fields['created_test'] = array(
'table' => 'views_test_data',
'field' => 'created',
);
$view
->build();
// Make sure the field aliases have the expected value.
$this
->assertEqual($id_field->aliases['job'], 'views_test_data_job');
$this
->assertEqual($id_field->aliases['created_test'], 'views_test_data_created');
$this
->executeView($view);
// Tests the get_value method with and without a field aliases.
foreach ($this
->dataSet() as $key => $row) {
$id = $key + 1;
$result = $view->result[$key];
$this
->assertEqual($id_field
->get_value($result), $id);
$this
->assertEqual($id_field
->get_value($result, 'job'), $row['job']);
$this
->assertEqual($id_field
->get_value($result, 'created_test'), $row['created']);
}
}