1 views_upgrade.test public ViewsUpgradeTestCase::testMovedTo()

Tests the moved to parameter in general.

File

core/modules/views/tests/views_upgrade.test, line 41
Definition of ViewsUpgradeTestCase.

Class

ViewsUpgradeTestCase
Try to test the upgrade path of all conversions.

Code

public function testMovedTo() {
  // Test moving on field level.
  $view = $this->viewsMovedToField();
  $view->update();
  $view->build();

  $this->assertEqual('id', $view->field['old_field_1']->real_field);
  $this->assertEqual('views_test', $view->field['old_field_1']->table);
  $this->assertEqual('old_field_1', $view->field['old_field_1']->original_field, 'The field should have stored the original_field');

  // Test moving on handler level.
  $view = $this->viewsMovedToHandler();
  $view->update();
  $view->build();

  $this->assertEqual('name', $view->field['old_field_2']->real_field);
  $this->assertEqual('views_test', $view->field['old_field_2']->table);

  $this->assertEqual('age', $view->filter['old_field_3']->real_field);
  $this->assertEqual('views_test', $view->filter['old_field_3']->table);

  // Test moving on table level.
  $view = $this->viewsMovedToTable();
  $view->update();
  $view->build();

  $this->assertEqual('views_test', $view->base_table, 'Make sure that view->base_table gets automatically converted.');
  $this->assertEqual('id', $view->field['id']->real_field, 'To run the query right the real_field has to be set right.');
  $this->assertEqual('views_test', $view->field['id']->table);
}