private function EntityContext::formatCount in Lightning Core 8.4
Same name and namespace in other branches
- 8.5 tests/contexts/EntityContext.behat.inc \Acquia\LightningExtension\Context\EntityContext::formatCount()
- 8 tests/contexts/EntityContext.behat.inc \Acquia\LightningExtension\Context\EntityContext::formatCount()
- 8.2 tests/contexts/EntityContext.behat.inc \Acquia\LightningExtension\Context\EntityContext::formatCount()
- 8.3 tests/contexts/EntityContext.behat.inc \Acquia\LightningExtension\Context\EntityContext::formatCount()
Generates a formatted entity count string.
Parameters
string $entity_type: The entity type ID.
int $n: The number of entities.
Return value
string A formatted entity count string, e.g. '33 content items'.
See also
::assertCount()
1 call to EntityContext::formatCount()
- EntityContext::assertCount in tests/
contexts/ EntityContext.behat.inc - Asserts that entities of a specific type and optional bundle exist.
File
- tests/
contexts/ EntityContext.behat.inc, line 216
Class
- EntityContext
- Contains miscellaneous step definitions for working with Drupal entities.
Namespace
Acquia\LightningExtension\ContextCode
private function formatCount($entity_type, $n) {
$entity_type = \Drupal::entityTypeManager()
->getDefinition($entity_type);
return (string) new Plural((int) $n, '@count ' . $entity_type
->getSingularLabel(), '@count' . $entity_type
->getPluralLabel());
}