Base class for tests.
Expanded class hierarchy of ParagraphsTestBase
abstract class ParagraphsTestBase extends LegacyParagraphsTestBase {
use ParagraphsTestBaseTrait;
/**
* Sets the Paragraphs widget add mode.
*
* @param string $content_type
* Content type name where to set the widget mode.
* @param string $paragraphs_field
* Paragraphs field to change the mode.
* @param string $mode
* Mode to be set. ('dropdown', 'select' or 'button').
*/
protected function setAddMode($content_type, $paragraphs_field, $mode) {
$form_display = EntityFormDisplay::load('node.' . $content_type . '.default')
->setComponent($paragraphs_field, [
'type' => 'paragraphs',
'settings' => [
'add_mode' => $mode,
],
]);
$form_display
->save();
}
/**
* Removes the default paragraph type.
*
* @param $content_type
* Content type name that contains the paragraphs field.
*/
protected function removeDefaultParagraphType($content_type) {
$this
->drupalGet('node/add/' . $content_type);
$this
->submitForm([], 'Remove');
$this
->assertSession()
->pageTextNotContains('No paragraphs added yet.');
}
}
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ParagraphsTestBase:: |
protected static | property | Modules to enable. | 48 |
ParagraphsTestBase:: |
protected | function | 19 | |
ParagraphsTestBase:: |
protected | property | 2 | |
ParagraphsTestBase:: |
protected | property | Drupal user object created by loginAsAdmin(). | 1 |
ParagraphsTestBase:: |
protected | function |
Sets the Paragraphs widget add mode. Overrides ParagraphsTestBase:: |
|
ParagraphsTestBase:: |
protected | function |
Removes the default paragraph type. Overrides ParagraphsTestBase:: |
|
ParagraphsTestBaseTrait:: |
protected | function | Adds a content type with a Paragraphs field. | |
ParagraphsTestBaseTrait:: |
protected | function | Adds a Paragraphs field to a given entity type. | |
ParagraphsTestBaseTrait:: |
protected | function | Adds a Paragraphs type. | |
ParagraphsTestBaseTrait:: |
protected | function | Adds an icon to a paragraphs type. | |
ParagraphsTestBaseTrait:: |
protected | function | Adds a field to a given paragraph type. | |
ParagraphsTestBaseTrait:: |
protected | function | Sets some of the settings of a paragraphs field widget. | |
ParagraphsTestBaseTrait:: |
protected | function | Creates a workflow entity. | |
ParagraphsTestBaseTrait:: |
protected | function | Checks the core version. | |
ParagraphsTestBase:: |
function | Creates an user with admin permissions and log in. | ||
ParagraphsTestBase:: |
protected | function | Sets the allowed Paragraphs types that can be added. | |
ParagraphsTestBase:: |
protected | function | Sets the weight of a given Paragraphs type. | |
ParagraphsTestBase:: |
protected | function | Sets the default paragraph type. | |
ParagraphsTestBase:: |
protected | function | Sets the Paragraphs widget display mode. | |
ParagraphsTestBaseTrait:: |
protected | property | The workflow entity. | |
ParagraphsTestBase:: |
protected | property | List of permissions used by loginAsAdmin(). |