You are here

public function TaxonomyIndexTidFilterTest::testConfigDependency in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyIndexTidFilterTest.php \Drupal\Tests\taxonomy\Kernel\Views\TaxonomyIndexTidFilterTest::testConfigDependency()
  2. 9 core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyIndexTidFilterTest.php \Drupal\Tests\taxonomy\Kernel\Views\TaxonomyIndexTidFilterTest::testConfigDependency()

Tests dependencies are not added for terms that do not exist.

File

core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyIndexTidFilterTest.php, line 62

Class

TaxonomyIndexTidFilterTest
Test the taxonomy term index filter.

Namespace

Drupal\Tests\taxonomy\Kernel\Views

Code

public function testConfigDependency() {

  /** @var \Drupal\views\Entity\View $view */
  $view = View::load('test_filter_taxonomy_index_tid__non_existing_dependency');

  // Dependencies are sorted.
  $content_dependencies = [
    $this->terms[3]
      ->getConfigDependencyName(),
    $this->terms[4]
      ->getConfigDependencyName(),
  ];
  sort($content_dependencies);
  $this
    ->assertEquals([
    'config' => [
      'taxonomy.vocabulary.tags',
    ],
    'content' => $content_dependencies,
    'module' => [
      'node',
      'taxonomy',
      'user',
    ],
  ], $view
    ->calculateDependencies()
    ->getDependencies());
  $this->terms[3]
    ->delete();
  $this
    ->assertEquals([
    'config' => [
      'taxonomy.vocabulary.tags',
    ],
    'content' => [
      $this->terms[4]
        ->getConfigDependencyName(),
    ],
    'module' => [
      'node',
      'taxonomy',
      'user',
    ],
  ], $view
    ->calculateDependencies()
    ->getDependencies());
}