You are here

function ImageFieldDisplayTestCase::testImageFieldFormatterAttributes in Drupal 7

Test passing attributes into the image field formatters.

File

modules/image/image.test, line 1080
Tests for image.module.

Class

ImageFieldDisplayTestCase
Test class to check that formatters and display settings are working.

Code

function testImageFieldFormatterAttributes() {
  $image = theme('image_formatter', array(
    'item' => array(
      'uri' => 'http://example.com/example.png',
      'attributes' => array(
        'data-image-field-formatter' => 'testFound',
      ),
      'alt' => t('Image field formatter attribute test.'),
      'title' => t('Image field formatter'),
    ),
  ));
  $this
    ->assertTrue(stripos($image, 'testFound') > 0, 'Image field formatters can have attributes.');
}