function EntityArgumentUpdateTest::testViewsFieldPluginConversion

Same name in other branches
  1. 11.x core/modules/views/tests/src/Functional/Update/EntityArgumentUpdateTest.php \Drupal\Tests\views\Functional\Update\EntityArgumentUpdateTest::testViewsFieldPluginConversion()

Tests that numeric argument plugins are updated properly.

File

core/modules/views/tests/src/Functional/Update/EntityArgumentUpdateTest.php, line 32

Class

EntityArgumentUpdateTest
Tests the upgrade path for converting numeric arguments to entity_target_id.

Namespace

Drupal\Tests\views\Functional\Update

Code

public function testViewsFieldPluginConversion() : void {
    $view = View::load('test_entity_id_argument_update');
    $data = $view->toArray();
    $this->assertEquals('numeric', $data['display']['default']['display_options']['arguments']['field_tags_target_id']['plugin_id']);
    $this->assertArrayNotHasKey('target_entity_type_id', $data['display']['default']['display_options']['arguments']['field_tags_target_id']);
    $this->runUpdates();
    $view = View::load('test_entity_id_argument_update');
    $data = $view->toArray();
    $this->assertEquals('entity_target_id', $data['display']['default']['display_options']['arguments']['field_tags_target_id']['plugin_id']);
    $this->assertEquals('taxonomy_term', $data['display']['default']['display_options']['arguments']['field_tags_target_id']['target_entity_type_id']);
}

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