public function ImageAdminStylesTest::getImageCount in Drupal 10
Same name and namespace in other branches
- 8 core/modules/image/tests/src/Functional/ImageAdminStylesTest.php \Drupal\Tests\image\Functional\ImageAdminStylesTest::getImageCount()
- 9 core/modules/image/tests/src/Functional/ImageAdminStylesTest.php \Drupal\Tests\image\Functional\ImageAdminStylesTest::getImageCount()
Count the number of images currently create for a style.
File
- core/
modules/ image/ tests/ src/ Functional/ ImageAdminStylesTest.php, line 51
Class
- ImageAdminStylesTest
- Tests creation, deletion, and editing of image styles and effects.
Namespace
Drupal\Tests\image\FunctionalCode
public function getImageCount(ImageStyleInterface $style) {
$count = 0;
if (is_dir('public://styles/' . $style
->id())) {
$count = count(\Drupal::service('file_system')
->scanDirectory('public://styles/' . $style
->id(), '/.*/'));
}
return $count;
}