You are here

function ImageAdminStylesTest::testNumericStyleName in Zircon Profile 8.0

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

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

File

core/modules/image/src/Tests/ImageAdminStylesTest.php, line 51
Contains \Drupal\image\Tests\ImageAdminStylesTest.

Class

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

Namespace

Drupal\image\Tests

Code

function testNumericStyleName() {
  $style_name = rand();
  $style_label = $this
    ->randomString();
  $edit = array(
    '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.', array(
    '%name' => $style_label,
  )));
  $options = image_style_options();
  $this
    ->assertTrue(array_key_exists($style_name, $options), format_string('Array key %key exists.', array(
    '%key' => $style_name,
  )));
}