9990094540df461a9ea9711408a5812a3a1ce40e
[yaffs-website] / web / core / modules / views / src / Tests / Update / FieldHandlersUpdateTest.php
1 <?php
2
3 namespace Drupal\views\Tests\Update;
4
5 use Drupal\system\Tests\Update\UpdatePathTestBase;
6 use Drupal\views\Entity\View;
7
8 /**
9  * Tests the upgrade path for views field handlers.
10  *
11  * @see views_post_update_cleanup_duplicate_views_data()
12  *
13  * @group Update
14  */
15 class FieldHandlersUpdateTest extends UpdatePathTestBase {
16
17   /**
18    * {@inheritdoc}
19    */
20   protected function setDatabaseDumpFiles() {
21     $this->databaseDumpFiles = [
22       __DIR__ . '/../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
23       __DIR__ . '/../../../tests/fixtures/update/duplicate-field-handler.php',
24     ];
25   }
26
27   /**
28    * Tests that field handlers are updated properly.
29    */
30   public function testViewsUpdate8004() {
31     $this->runUpdates();
32
33     // Load and initialize our test view.
34     $view = View::load('test_duplicate_field_handlers');
35     $data = $view->toArray();
36     // Check that the field is using the expected base table.
37     $this->assertEqual('node_field_data', $data['display']['default']['display_options']['fields']['nid']['table']);
38     $this->assertEqual('node_field_data', $data['display']['default']['display_options']['filters']['type']['table']);
39     $this->assertEqual('node_field_data', $data['display']['default']['display_options']['sorts']['vid']['table']);
40     $this->assertEqual('node_field_data', $data['display']['default']['display_options']['arguments']['nid']['table']);
41   }
42
43 }