TaxonomyLocalTasksTest.php

Same filename and directory in other branches
  1. 8.9.x core/modules/taxonomy/tests/src/Unit/Menu/TaxonomyLocalTasksTest.php
  2. 10 core/modules/taxonomy/tests/src/Unit/Menu/TaxonomyLocalTasksTest.php
  3. 11.x core/modules/taxonomy/tests/src/Unit/Menu/TaxonomyLocalTasksTest.php

Namespace

Drupal\Tests\taxonomy\Unit\Menu

File

core/modules/taxonomy/tests/src/Unit/Menu/TaxonomyLocalTasksTest.php

View source
<?php

namespace Drupal\Tests\taxonomy\Unit\Menu;

use Drupal\Tests\Core\Menu\LocalTaskIntegrationTestBase;

/**
 * Tests existence of taxonomy local tasks.
 *
 * @group taxonomy
 */
class TaxonomyLocalTasksTest extends LocalTaskIntegrationTestBase {
    
    /**
     * {@inheritdoc}
     */
    protected function setUp() : void {
        $this->directoryList = [
            'taxonomy' => 'core/modules/taxonomy',
        ];
        parent::setUp();
    }
    
    /**
     * Checks taxonomy edit local tasks.
     *
     * @dataProvider getTaxonomyPageRoutes
     */
    public function testTaxonomyPageLocalTasks($route, $subtask = []) {
        $tasks = [
            0 => [
                'entity.taxonomy_term.canonical',
                'entity.taxonomy_term.edit_form',
                'entity.taxonomy_term.delete_form',
            ],
        ];
        if ($subtask) {
            $tasks[] = $subtask;
        }
        $this->assertLocalTasks($route, $tasks);
    }
    
    /**
     * Provides a list of routes to test.
     */
    public function getTaxonomyPageRoutes() {
        return [
            [
                'entity.taxonomy_term.canonical',
            ],
            [
                'entity.taxonomy_term.edit_form',
            ],
        ];
    }

}

Classes

Title Deprecated Summary
TaxonomyLocalTasksTest Tests existence of taxonomy local tasks.

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