You are here

protected function FileListingTest::sumUsages in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/file/tests/src/Functional/FileListingTest.php \Drupal\Tests\file\Functional\FileListingTest::sumUsages()
  2. 9 core/modules/file/tests/src/Functional/FileListingTest.php \Drupal\Tests\file\Functional\FileListingTest::sumUsages()

Calculates total count of usages for a file.

Parameters

$usage array: Array of file usage information as returned from file_usage subsystem.

Return value

int Total usage count.

File

core/modules/file/tests/src/Functional/FileListingTest.php, line 60

Class

FileListingTest
Tests file listing page functionality.

Namespace

Drupal\Tests\file\Functional

Code

protected function sumUsages($usage) {
  $count = 0;
  foreach ($usage as $module) {
    foreach ($module as $entity_type) {
      foreach ($entity_type as $entity) {
        $count += $entity;
      }
    }
  }
  return $count;
}