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. 8.9.x 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()

Tests creating an image style with a numeric name.

File

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

Class

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

Namespace

Drupal\Tests\image\Functional

Code

public function testNumericStyleName() : void {
    $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()
        ->statusMessageContains("Style {$style_label} was created.", 'status');
    $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.