public function LocalTaskTest::testLocalTask in CRM Core 8.3
Test local tasks.
@covers \Drupal\crm_core_contact\Menu\ContactLocalTaskProvider::buildLocalTasks
File
- modules/
crm_core_contact/ tests/ src/ Kernel/ LocalTaskTest.php, line 42
Class
- LocalTaskTest
- Tests the local task provider.
Namespace
Drupal\Tests\crm_core_contact\KernelCode
public function testLocalTask() : void {
$type = IndividualType::create([
'name' => 'Consumer',
'type' => 'consumer',
'primary_fields' => [],
]);
$type
->save();
$individual = Individual::create([
'type' => 'consumer',
]);
$individual
->save();
$provider = new ContactLocalTaskProvider($individual
->getEntityType(), $this->container
->get('string_translation'));
$tasks = $provider
->buildLocalTasks($individual
->getEntityType());
$this
->assertEqual([
'entity.crm_core_individual.canonical' => [
'title' => 'View',
'route_name' => 'entity.crm_core_individual.canonical',
'base_route' => 'entity.crm_core_individual.canonical',
'weight' => 0,
],
'entity.crm_core_individual.edit_form' => [
'title' => 'Edit',
'route_name' => 'entity.crm_core_individual.edit_form',
'base_route' => 'entity.crm_core_individual.canonical',
'weight' => 10,
],
'entity.crm_core_individual.delete_form' => [
'title' => 'Delete',
'route_name' => 'entity.crm_core_individual.delete_form',
'base_route' => 'entity.crm_core_individual.canonical',
'weight' => 20,
],
'entity.crm_core_individual.version_history' => [
'title' => 'Revisions',
'route_name' => 'entity.crm_core_individual.version_history',
'base_route' => 'entity.crm_core_individual.canonical',
'weight' => 30,
],
], $tasks);
}