Skip to main content

Content blocks

DrevOps\BehatSteps\Steps\Drupal\ContentBlockTrait - Source, Example, Helpers

Manage Drupal content blocks.

  • Define reusable custom block content with structured field data.
  • Create and verify block_content entities by type and description, and visit their edit pages.
  • Created entities are automatically removed at the end of the scenario.

Prerequisites​

PrerequisiteCapability
A backend in the scenario's list provides "BlockCapabilityInterface"BlockCapabilityInterface
The core "block_content" module is enabledModuleCapabilityInterface

Steps​

@Given the following :content_block_type content blocks do not exist:

Remove content blocks of a specified type with the given descriptions

Given the following "basic" content blocks do not exist:
| [TEST] Footer Block |
| [TEST] Contact Form |
@Given the following :content_block_type content blocks exist:

Create content blocks of the specified type with the given field values

Given the following "basic" content blocks exist:
| info | status | body |
| [TEST] Footer Contact | 1 | Call us at 555-1234 |
| [TEST] Copyright | 1 | © 2023 Example Company |
@Given the following :content_block_type content blocks with fields exist:

Create content blocks with vertical field format

Given the following basic content blocks with fields exist:
| info | [TEST] Block 1 | [TEST] Block 2 |
| body | First block content | Second block content |
| status | 1 | 1 |
@When I visit the :content_block_type content block edit page with the description :description

Visit the edit page of the content block with the specified description

When I visit the "basic" content block edit page with the description "[TEST] Footer Block"
@Then the content block type :content_block_type should exist

Assert that a content block type exists

Then the content block type "Search" should exist