public function TaxonomyDefaultArgumentTest::testNodePathWithViewSelection in Drupal 10        
                          
                  
                        Same name and namespace in other branches
- 8 core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyDefaultArgumentTest.php \Drupal\Tests\taxonomy\Kernel\Views\TaxonomyDefaultArgumentTest::testNodePathWithViewSelection()
- 9 core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyDefaultArgumentTest.php \Drupal\Tests\taxonomy\Kernel\Views\TaxonomyDefaultArgumentTest::testNodePathWithViewSelection()
File
 
   - core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyDefaultArgumentTest.php, line 65
Class
  
  - TaxonomyDefaultArgumentTest 
- Tests the representative node relationship for terms.
Namespace
  Drupal\Tests\taxonomy\Kernel\Views
Code
public function testNodePathWithViewSelection() {
  
  \Drupal::service('module_installer')
    ->install([
    'entity_reference_test',
  ]);
  $field_name = 'field_' . $this->vocabulary
    ->id();
  $field = FieldConfig::loadByName('node', 'article', $field_name);
  $field
    ->setSetting('handler', 'views');
  $field
    ->setSetting('handler_settings', [
    'view' => [
      'view_name' => 'test_entity_reference',
      'display_name' => 'entity_reference_1',
    ],
  ]);
  $field
    ->save();
  $view = $this
    ->initViewWithRequest($this->nodes[0]
    ->toUrl()
    ->toString());
  $expected = implode(',', [
    $this->term1
      ->id(),
    $this->term2
      ->id(),
  ]);
  $this
    ->assertEquals($expected, $view->argument['tid']
    ->getDefaultArgument());
}