public function ImageFieldDefaultImagesTest::testInvalidDefaultImage in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/image/src/Tests/ImageFieldDefaultImagesTest.php \Drupal\image\Tests\ImageFieldDefaultImagesTest::testInvalidDefaultImage()
Tests image field and field having an invalid default image.
File
- core/
modules/ image/ src/ Tests/ ImageFieldDefaultImagesTest.php, line 313 - Contains \Drupal\image\Tests\ImageFieldDefaultImagesTest.
Class
- ImageFieldDefaultImagesTest
- Tests setting up default images both to the field and field field.
Namespace
Drupal\image\TestsCode
public function testInvalidDefaultImage() {
$field_storage = entity_create('field_storage_config', array(
'field_name' => Unicode::strtolower($this
->randomMachineName()),
'entity_type' => 'node',
'type' => 'image',
'settings' => array(
'default_image' => array(
'uuid' => 100000,
),
),
));
$field_storage
->save();
$settings = $field_storage
->getSettings();
// The non-existent default image should not be saved.
$this
->assertNull($settings['default_image']['uuid']);
$field = entity_create('field_config', array(
'field_storage' => $field_storage,
'bundle' => 'page',
'label' => $this
->randomMachineName(),
'settings' => array(
'default_image' => array(
'uuid' => 100000,
),
),
));
$field
->save();
$settings = $field
->getSettings();
// The non-existent default image should not be saved.
$this
->assertNull($settings['default_image']['uuid']);
}