function ImageFieldTestBase::previewNodeImage in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/image/src/Tests/ImageFieldTestBase.php \Drupal\image\Tests\ImageFieldTestBase::previewNodeImage()
Preview an image in a node.
Parameters
\Drupal\Core\Image\ImageInterface $image: A file object representing the image to upload.
string $field_name: Name of the image field the image should be attached to.
string $type: The type of node to create.
2 calls to ImageFieldTestBase::previewNodeImage()
- ImageFieldDisplayTest::_testImageFieldFormatters in core/
modules/ image/ src/ Tests/ ImageFieldDisplayTest.php - Test image formatters on node display.
- ResponsiveImageFieldDisplayTest::assertResponsiveImageFieldFormattersLink in core/
modules/ responsive_image/ src/ Tests/ ResponsiveImageFieldDisplayTest.php - Tests responsive image formatters linked to the file or node.
File
- core/
modules/ image/ src/ Tests/ ImageFieldTestBase.php, line 115 - Contains \Drupal\image\Tests\ImageFieldTestBase.
Class
- ImageFieldTestBase
- This class provides methods specifically for testing Image's field handling.
Namespace
Drupal\image\TestsCode
function previewNodeImage($image, $field_name, $type) {
$edit = array(
'title[0][value]' => $this
->randomMachineName(),
);
$edit['files[' . $field_name . '_0]'] = drupal_realpath($image->uri);
$this
->drupalPostForm('node/add/' . $type, $edit, t('Preview'));
}