You are here

protected function FileListingTest::sumUsages in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/file/src/Tests/FileListingTest.php \Drupal\file\Tests\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.

1 call to FileListingTest::sumUsages()
FileListingTest::testFileListingPages in core/modules/file/src/Tests/FileListingTest.php
Tests file overview with different user permissions.

File

core/modules/file/src/Tests/FileListingTest.php, line 50
Contains \Drupal\file\Tests\FileListingTest.

Class

FileListingTest
Tests file listing page functionality.

Namespace

Drupal\file\Tests

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;
}