protected function ImageFieldFormatterTest::setUp in Entity Embed 8
Same name in this branch
- 8 tests/src/Functional/ImageFieldFormatterTest.php \Drupal\Tests\entity_embed\Functional\ImageFieldFormatterTest::setUp()
- 8 tests/src/FunctionalJavascript/ImageFieldFormatterTest.php \Drupal\Tests\entity_embed\FunctionalJavascript\ImageFieldFormatterTest::setUp()
Overrides BrowserTestBase::setUp
File
- tests/
src/ FunctionalJavascript/ ImageFieldFormatterTest.php, line 66
Class
- ImageFieldFormatterTest
- Tests ckeditor integration.
Namespace
Drupal\Tests\entity_embed\FunctionalJavascriptCode
protected function setUp() {
parent::setUp();
$this->button = $this->container
->get('entity_type.manager')
->getStorage('embed_button')
->create([
'label' => 'Image Embed',
'id' => 'image_embed',
'type_id' => 'entity',
'type_settings' => [
'entity_type' => 'file',
'display_plugins' => [
'image:image',
],
'entity_browser' => '',
'entity_browser_settings' => [
'display_review' => FALSE,
],
],
'icon_uuid' => NULL,
]);
$this->button
->save();
$format = FilterFormat::create([
'format' => 'embed_test',
'name' => 'Embed format',
'filters' => [],
]);
$format
->save();
$editor = Editor::create([
'format' => 'embed_test',
'editor' => 'ckeditor',
'settings' => [
'toolbar' => [
'rows' => [],
],
],
]);
$editor
->save();
$this
->drupalCreateContentType([
'type' => 'page',
'name' => 'Basic page',
]);
$this->adminUser = $this
->drupalCreateUser([
'access administration pages',
'administer filters',
'administer display modes',
'administer embed buttons',
'administer site configuration',
'administer display modes',
'administer content types',
'administer node display',
'access content',
'create page content',
$format
->getPermissionName(),
]);
$this
->drupalLogin($this->adminUser);
// Create a sample image to embed.
\Drupal::service('file_system')
->copy(\Drupal::root() . '/core/misc/druplicon.png', 'public://rainbow-kitten.png');
// Resize the test image so that it will be scaled down during token
// replacement.
$image1 = $this->container
->get('image.factory')
->get('public://rainbow-kitten.png');
$image1
->resize(500, 500);
$image1
->save();
$this->image = $this->container
->get('entity_type.manager')
->getStorage('file')
->create([
'uri' => 'public://rainbow-kitten.png',
'status' => 1,
]);
$this->image
->save();
$this->invalidImage = $this->container
->get('entity_type.manager')
->getStorage('file')
->create([
'uri' => 'public://nonexistentimage.jpg',
'filename' => 'nonexistentimage.jpg',
'status' => 1,
]);
$this->invalidImage
->save();
}