You are here

public function ImageAdminStylesTest::testNumericStyleName 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::testNumericStyleName()

Tests creating an image style with a numeric name.

File

core/modules/image/tests/src/Functional/ImageAdminStylesTest.php, line 62

Class

ImageAdminStylesTest
Tests creation, deletion, and editing of image styles and effects.

Namespace

Drupal\Tests\image\Functional

Code

public function testNumericStyleName() {
  $style_name = rand();
  $style_label = $this
    ->randomString();
  $edit = [
    'name' => $style_name,
    'label' => $style_label,
  ];
  $this
    ->drupalGet('admin/config/media/image-styles/add');
  $this
    ->submitForm($edit, 'Create new style');
  $this
    ->assertSession()
    ->pageTextContains("Style {$style_label} was created.");
  $options = image_style_options();
  $this
    ->assertArrayHasKey($style_name, $options);
}