You are here

function file_link_test_entity_save_counter in File Link 2.0.x

Get the count of how many times an entity was saved.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity.

Return value

int The count.

2 calls to file_link_test_entity_save_counter()
FileLinkDeferredTest::testDeferredCheck in tests/src/Kernel/FileLinkDeferredTest.php
Tests file_link field metadata storage with extension.
FileLinkDeferredTest::testDeletedEntity in tests/src/Kernel/FileLinkDeferredTest.php
Tests file_link field metadata storage with extension.

File

tests/modules/file_link_test/file_link_test.module, line 14

Code

function file_link_test_entity_save_counter(EntityInterface $entity) {
  global $entity_save_counter;
  $key = $entity
    ->getEntityTypeId() . $entity
    ->id();
  if (!isset($entity_save_counter[$key])) {
    $entity_save_counter[$key] = 0;
  }
  return $entity_save_counter[$key];
}