You are here

public function ImageAdminStylesTest::testNumericStyleName in Drupal 8

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

Test creating an image style with a numeric name and ensuring it can be applied to an image.

File

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

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
    ->drupalPostForm('admin/config/media/image-styles/add', $edit, t('Create new style'));
  $this
    ->assertRaw(t('Style %name was created.', [
    '%name' => $style_label,
  ]));
  $options = image_style_options();
  $this
    ->assertArrayHasKey($style_name, $options);
}