protected function EntityEmbedTestBase::setUp in Entity Embed 8
Overrides BrowserTestBase::setUp
5 calls to EntityEmbedTestBase::setUp()
- EntityEmbedHooksTest::setUp in tests/
src/ Functional/ EntityEmbedHooksTest.php - EntityEmbedTwigTest::setUp in tests/
src/ Functional/ EntityEmbedTwigTest.php - EntityReferenceFieldFormatterTest::setUp in tests/
src/ Functional/ EntityReferenceFieldFormatterTest.php - FileFieldFormatterTest::setUp in tests/
src/ Functional/ FileFieldFormatterTest.php - ImageFieldFormatterTest::setUp in tests/
src/ Functional/ ImageFieldFormatterTest.php
5 methods override EntityEmbedTestBase::setUp()
- EntityEmbedHooksTest::setUp in tests/
src/ Functional/ EntityEmbedHooksTest.php - EntityEmbedTwigTest::setUp in tests/
src/ Functional/ EntityEmbedTwigTest.php - EntityReferenceFieldFormatterTest::setUp in tests/
src/ Functional/ EntityReferenceFieldFormatterTest.php - FileFieldFormatterTest::setUp in tests/
src/ Functional/ FileFieldFormatterTest.php - ImageFieldFormatterTest::setUp in tests/
src/ Functional/ ImageFieldFormatterTest.php
File
- tests/
src/ Functional/ EntityEmbedTestBase.php, line 53
Class
- EntityEmbedTestBase
- Base class for all entity_embed tests.
Namespace
Drupal\Tests\entity_embed\FunctionalCode
protected function setUp() {
parent::setUp();
// Create a page content type.
$this
->drupalCreateContentType([
'type' => 'page',
'name' => 'Basic page',
]);
// Create a text format and enable the entity_embed filter.
$format = FilterFormat::create([
'format' => 'custom_format',
'name' => 'Custom format',
'filters' => [
'filter_align' => [
'status' => 1,
],
'filter_caption' => [
'status' => 1,
],
'filter_html_image_secure' => [
'status' => 1,
],
'entity_embed' => [
'status' => 1,
],
],
]);
$format
->save();
$editor_group = [
'name' => 'Entity Embed',
'items' => [
'node',
],
];
$editor = Editor::create([
'format' => 'custom_format',
'editor' => 'ckeditor',
'settings' => [
'toolbar' => [
'rows' => [
[
$editor_group,
],
],
],
],
]);
$editor
->save();
// Create a user with required permissions.
$this->webUser = $this
->drupalCreateUser([
'access content',
'create page content',
'use text format custom_format',
]);
$this
->drupalLogin($this->webUser);
// Create a sample node to be embedded.
$settings = [];
$settings['type'] = 'page';
$settings['title'] = 'Embed Test Node';
$settings['body'] = [
'value' => 'This node is to be used for embedding in other nodes.',
'format' => 'custom_format',
];
$this->node = $this
->drupalCreateNode($settings);
}