function TaxonomyIndexTidFilterTest::testConfigDependency

Same name in other branches
  1. 9 core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyIndexTidFilterTest.php \Drupal\Tests\taxonomy\Kernel\Views\TaxonomyIndexTidFilterTest::testConfigDependency()
  2. 8.9.x core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyIndexTidFilterTest.php \Drupal\Tests\taxonomy\Kernel\Views\TaxonomyIndexTidFilterTest::testConfigDependency()
  3. 10 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 64

Class

TaxonomyIndexTidFilterTest
Test the taxonomy term index filter.

Namespace

Drupal\Tests\taxonomy\Kernel\Views

Code

public function testConfigDependency() : void {
    
    /** @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());
}

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