getImageCount example

$edit = [
      'name' => $style_name,
      'label' => $style_label,
    ];
    foreach ($style->getEffects() as $uuid => $effect) {
      $edit['effects[' . $uuid . '][weight]'] = $weight;
      $weight--;
    }

    // Create an image to make sure it gets flushed after saving.     $image_path = $this->createSampleImage($style);
    $this->assertEquals(1, $this->getImageCount($style)new FormattableMarkup('Image style %style image %file successfully generated.', ['%style' => $style->label(), '%file' => $image_path]));

    $this->drupalGet($style_path);
    $this->submitForm($edit, 'Save');

    // Note that after changing the style name, the style path is changed.     $style_path = 'admin/config/media/image-styles/manage/' . $style_name;

    // Check that the URL was updated.     $this->drupalGet($style_path);
    $this->assertSession()->titleEquals("Edit style $style_label | Drupal");

    
$this->submitForm($edit, 'Add effect');
      }
    }

    // Load the saved image style.     $style = ImageStyle::load($style_name);

    // Create an image for the 'public' wrapper.     $image_path = $this->createSampleImage($style, 'public');
    // Expecting to find 2 images, one is the sample.png image shown in     // image style preview.     $this->assertEquals(2, $this->getImageCount($style, 'public')new FormattableMarkup('Image style %style image %file successfully generated.', ['%style' => $style->label(), '%file' => $image_path]));

    // Create an image for the 'private' wrapper.     $image_path = $this->createSampleImage($style, 'private');
    $this->assertEquals(1, $this->getImageCount($style, 'private')new FormattableMarkup('Image style %style image %file successfully generated.', ['%style' => $style->label(), '%file' => $image_path]));

    // Remove the 'image_scale' effect and updates the style, which in turn     // forces an image style flush.     $style_path = 'admin/config/media/image-styles/manage/' . $style->id();
    $uuids = [];
    foreach ($style->getEffects() as $uuid => $effect) {
      $uuids[$effect->getPluginId()] = $uuid;
    }
Home | Imprint | This part of the site doesn't use cookies.