function ImageAdminStylesTest::testNumericStyleName

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

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