class EntityArgumentUpdateTest

Same name and namespace in other branches
  1. 11.x core/modules/views/tests/src/Functional/Update/EntityArgumentUpdateTest.php \Drupal\Tests\views\Functional\Update\EntityArgumentUpdateTest

Tests the upgrade path for converting numeric arguments to entity_target_id.

@group Update

Hierarchy

Expanded class hierarchy of EntityArgumentUpdateTest

See also

views_post_update_views_data_argument_plugin_id()

File

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

Namespace

Drupal\Tests\views\Functional\Update
View source
class EntityArgumentUpdateTest extends UpdatePathTestBase {
  
  /**
   * {@inheritdoc}
   */
  protected function setDatabaseDumpFiles() : void {
    $this->databaseDumpFiles = [
      __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-10.3.0.filled.standard.php.gz',
      __DIR__ . '/../../../fixtures/update/entity-id-argument.php',
    ];
  }
  
  /**
   * Tests that numeric argument plugins are updated properly.
   */
  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']);
  }

}

Members

Title Sort descending Modifiers Object type Summary
EntityArgumentUpdateTest::setDatabaseDumpFiles protected function Set database dump files to be used.
EntityArgumentUpdateTest::testViewsFieldPluginConversion public function Tests that numeric argument plugins are updated properly.

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