Tests paragraphs stable alter widget by type.
@group paragraphs
Expanded class hierarchy of ParagraphsAlterByTypeTest
class ParagraphsAlterByTypeTest extends ParagraphsTestBase {
/**
* Modules to enable.
*
* @var array
*/
protected static $modules = [
'paragraphs_test',
];
/**
* Test widget alter based on paragraph type
*/
public function testAlterBasedOnType() {
$this
->addParagraphedContentType('paragraphed_test', 'field_paragraphs', 'entity_reference_paragraphs');
$this
->loginAsAdmin([
'create paragraphed_test content',
'edit any paragraphed_test content',
]);
// Add a Paragraph type.
$paragraph_type = 'altered_paragraph';
$this
->addParagraphsType($paragraph_type);
// Add a text field to the altered_paragraph type.
static::fieldUIAddNewField('admin/structure/paragraphs_type/' . $paragraph_type, 'text', 'Normal title', 'text_long', [], []);
// Check that the form alteration based on Paragraphs type works.
// See paragraphs_test_field_widget_entity_reference_paragraphs_form_alter()
$this
->drupalGet('node/add/paragraphed_test');
$this
->assertSession()
->pageTextContains('Altered title');
}
}
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ParagraphsAlterByTypeTest:: |
protected static | property |
Modules to enable. Overrides ParagraphsTestBase:: |
|
ParagraphsAlterByTypeTest:: |
public | function | Test widget alter based on paragraph type | |
ParagraphsTestBase:: |
protected | property | List of permissions used by loginAsAdmin(). | |
ParagraphsTestBase:: |
protected | property | Drupal user object created by loginAsAdmin(). | 1 |
ParagraphsTestBase:: |
protected | property | 2 | |
ParagraphsTestBase:: |
function | Creates an user with admin permissions and log in. | ||
ParagraphsTestBase:: |
protected | function |
Removes the default paragraph type. Overrides ParagraphsTestBase:: |
|
ParagraphsTestBase:: |
protected | function |
Sets the Paragraphs widget add mode. Overrides ParagraphsTestBase:: |
|
ParagraphsTestBase:: |
protected | function | Sets the allowed Paragraphs types that can be added. | |
ParagraphsTestBase:: |
protected | function | Sets the default paragraph type. | |
ParagraphsTestBase:: |
protected | function | Sets the weight of a given Paragraphs type. | |
ParagraphsTestBase:: |
protected | function | Sets the Paragraphs widget display mode. | |
ParagraphsTestBase:: |
protected | function | 19 | |
ParagraphsTestBaseTrait:: |
protected | property | The workflow entity. | |
ParagraphsTestBaseTrait:: |
protected | function | Adds a field to a given paragraph type. | |
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 | Checks the core version. | |
ParagraphsTestBaseTrait:: |
protected | function | Creates a workflow entity. | |
ParagraphsTestBaseTrait:: |
protected | function | Sets some of the settings of a paragraphs field widget. |