function ImageFieldDisplayTestCase::testImageFieldFormatterAttributes

7.x image.test ImageFieldDisplayTestCase::testImageFieldFormatterAttributes()

Test passing attributes into the image field formatters.

File

drupal-7.x/modules/image/image.test, line 975
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.');
}