You are here

public function ImageStyleFlushTest::getImageCount in Drupal 10

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

Count the number of images currently created for a style in a wrapper.

File

core/modules/image/tests/src/Functional/ImageStyleFlushTest.php, line 49

Class

ImageStyleFlushTest
Tests flushing of image styles.

Namespace

Drupal\Tests\image\Functional

Code

public function getImageCount($style, $wrapper) {
  $count = 0;
  if (is_dir($wrapper . '://styles/' . $style
    ->id())) {
    $count = count(\Drupal::service('file_system')
      ->scanDirectory($wrapper . '://styles/' . $style
      ->id(), '/.*/'));
  }
  return $count;
}