3 namespace Drupal\paragraphs\Tests\Experimental;
5 use Drupal\Core\Entity\Entity\EntityFormDisplay;
6 use Drupal\Core\Entity\Entity\EntityViewDisplay;
7 use Drupal\field\Entity\FieldConfig;
8 use Drupal\field\Entity\FieldStorageConfig;
9 use Drupal\field_ui\Tests\FieldUiTestTrait;
10 use Drupal\paragraphs\Tests\Classic\ParagraphsTestBase;
11 use Drupal\Tests\paragraphs\FunctionalJavascript\ParagraphsTestBaseTrait;
14 * Base class for tests.
16 abstract class ParagraphsExperimentalTestBase extends ParagraphsTestBase {
18 use FieldUiTestTrait, ParagraphsTestBaseTrait;
21 * Sets the Paragraphs widget add mode.
23 * @param string $content_type
24 * Content type name where to set the widget mode.
25 * @param string $paragraphs_field
26 * Paragraphs field to change the mode.
28 * Mode to be set. ('dropdown', 'select' or 'button').
30 protected function setAddMode($content_type, $paragraphs_field, $mode) {
31 $form_display = EntityFormDisplay::load('node.' . $content_type . '.default')
32 ->setComponent($paragraphs_field, [
33 'type' => 'paragraphs',
34 'settings' => ['add_mode' => $mode]
36 $form_display->save();
40 * Removes the default paragraph type.
42 * @param $content_type
43 * Content type name that contains the paragraphs field.
45 protected function removeDefaultParagraphType($content_type) {
46 $this->drupalGet('node/add/' . $content_type);
47 $this->drupalPostForm(NULL, [], 'Remove');
48 $this->assertNoText('No paragraphs added yet.');