function ImageStyleFlushTest::getImageCount

Same name in other branches
  1. 7.x modules/image/image.test \ImageStyleFlushTest::getImageCount()
  2. 9 core/modules/image/tests/src/Functional/ImageStyleFlushTest.php \Drupal\Tests\image\Functional\ImageStyleFlushTest::getImageCount()
  3. 8.9.x core/modules/image/tests/src/Functional/ImageStyleFlushTest.php \Drupal\Tests\image\Functional\ImageStyleFlushTest::getImageCount()
  4. 11.x 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.

1 call to ImageStyleFlushTest::getImageCount()
ImageStyleFlushTest::testFlush in core/modules/image/tests/src/Functional/ImageStyleFlushTest.php
General test to flush a style.

File

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

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.