You are here

public function TransactionAdminTest::doTestAddTargetEntityTypeLocalTask in Transaction 8

Tests add local task on target entity type from the transaction type edit.

See also

\Drupal\transaction\Form\TransactionTypeEditForm

1 call to TransactionAdminTest::doTestAddTargetEntityTypeLocalTask()
TransactionAdminTest::testAdmin in tests/src/Functional/TransactionAdminTest.php
Full admin test sequence.

File

tests/src/Functional/TransactionAdminTest.php, line 152

Class

TransactionAdminTest
Tests the transaction administration.

Namespace

Drupal\Tests\transaction\Functional

Code

public function doTestAddTargetEntityTypeLocalTask() {
  $post = [
    // Execution control: ask user.
    'local_task' => TRUE,
  ];
  $this
    ->drupalPostForm('admin/config/workflow/transaction/edit/generic_workflow', $post, 'Save transaction type');

  // Check that the option were saved.

  /** @var \Drupal\transaction\TransactionTypeInterface $transaction_type */
  $transaction_type = TransactionType::load('generic_workflow');
  $transaction_type_options = $transaction_type
    ->getOptions();
  $this
    ->assertNotEmpty($transaction_type_options['local_task']);

  // Check that the target entity type transaction list route was added.

  /** @var \Drupal\Core\Routing\RouteProviderInterface $route_provider */
  $route_provider = \Drupal::service('router.route_provider');
  $route = $route_provider
    ->getRouteByName('entity.entity_test.generic_workflow-transaction');
  $this
    ->assertNotNull($route);
}