You are here

public function ImageFieldWidgetTest::testWidgetElement in Zircon Profile 8.0

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

Tests file widget element.

File

core/modules/image/src/Tests/ImageFieldWidgetTest.php, line 20
Contains \Drupal\image\Tests\ImageFieldWidgetTest.

Class

ImageFieldWidgetTest
Tests the image field widget.

Namespace

Drupal\image\Tests

Code

public function testWidgetElement() {

  // Check for image widget in add/node/article page
  $field_name = strtolower($this
    ->randomMachineName());
  $min_resolution = 50;
  $max_resolution = 100;
  $field_settings = array(
    'max_resolution' => $max_resolution . 'x' . $max_resolution,
    'min_resolution' => $min_resolution . 'x' . $min_resolution,
    'alt_field' => 0,
  );
  $this
    ->createImageField($field_name, 'article', array(), $field_settings);
  $this
    ->drupalGet('node/add/article');
  $this
    ->assertNotEqual(0, count($this
    ->xpath('//div[contains(@class, "field--widget-image-image")]')), 'Image field widget found on add/node page', 'Browser');
}