TaxonomyTermArgumentDepthTest.php

Same filename in this branch
  1. 10 core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyTermArgumentDepthTest.php
Same filename in other branches
  1. 9 core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyTermArgumentDepthTest.php
  2. 9 core/modules/taxonomy/tests/src/Functional/Views/TaxonomyTermArgumentDepthTest.php
  3. 8.9.x core/modules/taxonomy/tests/src/Functional/Views/TaxonomyTermArgumentDepthTest.php
  4. 11.x core/modules/taxonomy/tests/src/Kernel/Views/TaxonomyTermArgumentDepthTest.php
  5. 11.x core/modules/taxonomy/tests/src/Functional/Views/TaxonomyTermArgumentDepthTest.php

Namespace

Drupal\Tests\taxonomy\Functional\Views

File

core/modules/taxonomy/tests/src/Functional/Views/TaxonomyTermArgumentDepthTest.php

View source
<?php

declare (strict_types=1);
namespace Drupal\Tests\taxonomy\Functional\Views;


/**
 * Tests the taxonomy term with depth argument.
 *
 * @group taxonomy
 */
class TaxonomyTermArgumentDepthTest extends TaxonomyTestBase {
    
    /**
     * {@inheritdoc}
     */
    protected static $modules = [
        'taxonomy',
        'taxonomy_test_views',
        'views',
        'node',
    ];
    
    /**
     * {@inheritdoc}
     */
    protected $defaultTheme = 'stark';
    
    /**
     * {@inheritdoc}
     */
    public static $testViews = [
        'test_argument_taxonomy_index_tid_depth',
    ];
    
    /**
     * @var \Drupal\taxonomy\TermInterface[]
     */
    protected $terms = [];
    
    /**
     * @var \Drupal\views\ViewExecutable
     */
    protected $view;
    
    /**
     * {@inheritdoc}
     */
    protected function setUp($import_test_views = TRUE, $modules = []) : void {
        parent::setUp($import_test_views, $modules);
        // Create a term with markup in the label.
        $first = $this->createTerm([
            'name' => '<em>First</em>',
        ]);
        // Create a node w/o any terms.
        $settings = [
            'type' => 'article',
        ];
        // Create a node with linked to the term.
        $settings['field_views_testing_tags'][0]['target_id'] = $first->id();
        $this->nodes[] = $this->drupalCreateNode($settings);
        $this->terms[0] = $first;
    }
    
    /**
     * Tests title escaping.
     */
    public function testTermWithDepthArgumentTitleEscaping() : void {
        $this->drupalGet('test_argument_taxonomy_index_tid_depth/' . $this->terms[0]
            ->id());
        $this->assertSession()
            ->assertEscaped($this->terms[0]
            ->label());
    }

}

Classes

Title Deprecated Summary
TaxonomyTermArgumentDepthTest Tests the taxonomy term with depth argument.

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