public function EntityCloneResponsiveImageStyleTest::testResponsiveImageStyleEntityClone in Entity Clone 8
Test responsive image style entity clone.
File
- tests/
src/ Functional/ EntityCloneResponsiveImageStyleTest.php, line 58
Class
- EntityCloneResponsiveImageStyleTest
- Create a responsive image style and test a clone.
Namespace
Drupal\Tests\entity_clone\FunctionalCode
public function testResponsiveImageStyleEntityClone() {
$edit = [
'label' => 'Test responsive image style for clone',
'id' => 'test_responsive_image_style_for_clone',
'breakpoint_group' => 'responsive_image',
'fallback_image_style' => 'large',
];
$this
->drupalPostForm("admin/config/media/responsive-image-style/add", $edit, t('Save'));
$responsive_image_styles = \Drupal::entityTypeManager()
->getStorage('responsive_image_style')
->loadByProperties([
'id' => $edit['id'],
]);
$responsive_image_style = reset($responsive_image_styles);
$edit = [
'id' => 'test_responsive_image_style_cloned',
'label' => 'Test responsive image style cloned',
];
$this
->drupalPostForm('entity_clone/responsive_image_style/' . $responsive_image_style
->id(), $edit, t('Clone'));
$responsive_image_styles = \Drupal::entityTypeManager()
->getStorage('responsive_image_style')
->loadByProperties([
'id' => $edit['id'],
]);
$responsive_image_style = reset($responsive_image_styles);
$this
->assertInstanceOf(ResponsiveImageStyle::class, $responsive_image_style, 'Test responsive image style cloned found in database.');
}