function TaxonomyIndexTidFilterTest::testPostUpdateFunction

Tests post update function fixes dependencies.

See also

views_post_update_taxonomy_index_tid()

File

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

Class

TaxonomyIndexTidFilterTest
Test the taxonomy term index filter.

Namespace

Drupal\Tests\taxonomy\Kernel\Views

Code

public function testPostUpdateFunction() {
    
    /** @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();
    \Drupal::moduleHandler()->loadInclude('views', 'post_update.php');
    views_post_update_taxonomy_index_tid();
    $view = View::load('test_filter_taxonomy_index_tid__non_existing_dependency');
    $this->assertEquals([
        'config' => [
            'taxonomy.vocabulary.tags',
        ],
        'content' => [
            $this->terms[4]
                ->getConfigDependencyName(),
        ],
        'module' => [
            'node',
            'taxonomy',
            'user',
        ],
    ], $view->getDependencies());
}

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