function ImageAdminStylesTest::getImageCount

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

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

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