protected function EntityUtilsTrait::changeEntityAliasesAndValidate in Apigee Edge 8
Changes and validates the singular and plural aliases of the entity.
Parameters
string $entity_type_id: The ID of the entity type.
string $entity_settings_route_name: The name of the entity settings route.
2 calls to EntityUtilsTrait::changeEntityAliasesAndValidate()
- DeveloperAppUITest::testDeveloperAppLabel in tests/
src/ Functional/ DeveloperAppUITest.php - Tests the developer app label modification.
- UiTest::teamAndTeamAppLabelTest in modules/
apigee_edge_teams/ tests/ src/ Functional/ UiTest.php - Tests the team entity label modifications.
File
- tests/
src/ Traits/ EntityUtilsTrait.php, line 37
Class
- EntityUtilsTrait
- A trait to common functions of Apigee Edge entity tests.
Namespace
Drupal\Tests\apigee_edge\TraitsCode
protected function changeEntityAliasesAndValidate(string $entity_type_id, string $entity_settings_route_name) {
$singular = $this
->getRandomGenerator()
->word(8);
$plural = $this
->getRandomGenerator()
->word(8);
$this
->drupalPostForm(Url::fromRoute($entity_settings_route_name), [
'entity_label_singular' => $singular,
'entity_label_plural' => $plural,
], 'Save configuration');
\Drupal::entityTypeManager()
->clearCachedDefinitions();
\Drupal::cache('menu')
->invalidateAll();
$type = \Drupal::entityTypeManager()
->getDefinition($entity_type_id);
$this
->assertEquals($singular, $type
->getSingularLabel());
$this
->assertEquals($plural, $type
->getPluralLabel());
}