class TaxonomyLocalTasksTest

Same name and namespace in other branches
  1. 11.x core/modules/taxonomy/tests/src/Unit/Menu/TaxonomyLocalTasksTest.php \Drupal\Tests\taxonomy\Unit\Menu\TaxonomyLocalTasksTest

Tests existence of taxonomy local tasks.

@group taxonomy

Hierarchy

Expanded class hierarchy of TaxonomyLocalTasksTest

File

core/modules/taxonomy/tests/src/Unit/Menu/TaxonomyLocalTasksTest.php, line 12

Namespace

Drupal\Tests\taxonomy\Unit\Menu
View source
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',
      ],
    ];
  }

}

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