You are here

public function ImageAdminStylesTest::getImageCount in Drupal 9

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

Count the number of images currently create for a style.

3 calls to ImageAdminStylesTest::getImageCount()
ImageAdminStylesTest::testConfigImport in core/modules/image/tests/src/Functional/ImageAdminStylesTest.php
Tests image style configuration import that does a delete.
ImageAdminStylesTest::testFlushUserInterface in core/modules/image/tests/src/Functional/ImageAdminStylesTest.php
Tests flush user interface.
ImageAdminStylesTest::testStyle in core/modules/image/tests/src/Functional/ImageAdminStylesTest.php
General test to add a style, add/remove/edit effects to it, then delete it.

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\Functional

Code

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