function ViewsFixRevisionIdUpdateTest::testViewsPostUpdateFixRevisionId
Same name in other branches
- 10 core/modules/views/tests/src/Functional/Update/ViewsFixRevisionIdUpdateTest.php \Drupal\Tests\views\Functional\Update\ViewsFixRevisionIdUpdateTest::testViewsPostUpdateFixRevisionId()
Tests the upgrade path for revision ids in field aliases.
File
-
core/
modules/ views/ tests/ src/ Functional/ Update/ ViewsFixRevisionIdUpdateTest.php, line 47
Class
- ViewsFixRevisionIdUpdateTest
- Tests the upgrade path for revision ids in field aliases.
Namespace
Drupal\Tests\views\Functional\UpdateCode
public function testViewsPostUpdateFixRevisionId() {
$view = View::load('test_fix_revision_id_update');
$data = $view->toArray();
$fields = $data['display']['default']['display_options']['fields'];
$this->assertArrayHasKey('field_test-revision_id_1', $fields);
$this->assertEquals('field_test-revision_id_1', $fields['field_test-revision_id_1']['id']);
$this->assertEquals('field_test-revision_id', $fields['field_test-revision_id_1']['field']);
$this->assertEquals('Replace: {{ field_test-revision_id_1 }}', $fields['field_test-revision_id_1']['alter']['text']);
$this->assertArrayHasKey('field_test-revision_id_2', $fields);
$this->assertEquals('field_test-revision_id_2', $fields['field_test-revision_id_2']['id']);
$this->assertEquals('field_test-revision_id', $fields['field_test-revision_id_2']['field']);
$this->assertEquals('field_test-revision_id_2: {{ field_test-revision_id_2 }}', $fields['field_test-revision_id_2']['alter']['text']);
$this->runUpdates();
$view = View::load('test_fix_revision_id_update');
$data = $view->toArray();
$fields = $data['display']['default']['display_options']['fields'];
$this->assertArrayNotHasKey('field_test-revision_id_1', $fields);
$this->assertArrayHasKey('field_test__revision_id_1', $fields);
$this->assertEquals('field_test__revision_id_1', $fields['field_test__revision_id_1']['id']);
$this->assertEquals('field_test__revision_id', $fields['field_test__revision_id_1']['field']);
$this->assertEquals('Replace: {{ field_test__revision_id_1 }}', $fields['field_test__revision_id_1']['alter']['text']);
$this->assertArrayNotHasKey('field_test-revision_id_2', $fields);
$this->assertArrayHasKey('field_test__revision_id_2', $fields);
$this->assertEquals('field_test__revision_id_2', $fields['field_test__revision_id_2']['id']);
$this->assertEquals('field_test__revision_id', $fields['field_test__revision_id_2']['field']);
$this->assertEquals('field_test-revision_id_2: {{ field_test__revision_id_2 }}', $fields['field_test__revision_id_2']['alter']['text']);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.