function ViewsSortIdentifiersUpdateTest::testSortIdentifierPostUpdate

Tests views_post_update_sort_identifier().

See also

views_post_update_sort_identifier()

File

core/modules/views/tests/src/Functional/Update/ViewsSortIdentifiersUpdateTest.php, line 29

Class

ViewsSortIdentifiersUpdateTest
Tests the views_post_update_sort_identifier() post update.

Namespace

Drupal\Tests\views\Functional\Update

Code

public function testSortIdentifierPostUpdate() : void {
    $config_factory = \Drupal::configFactory();
    $view = $config_factory->get('views.view.comments_recent');
    $trail = 'display.default.display_options.sorts.created';
    $this->assertArrayNotHasKey('field_identifier', $view->get("{$trail}.expose"));
    $this->runUpdates();
    $view = $config_factory->get('views.view.comments_recent');
    $sort_handler = $view->get($trail);
    $this->assertSame($sort_handler['id'], $sort_handler['expose']['field_identifier']);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.