Content
DrevOps\BehatSteps\Steps\Drupal\ContentTrait - Source, Example, Helpers
Manage Drupal content with workflow and moderation support.
- Create, find, and manipulate nodes with structured field data.
- Navigate to node pages by title and manage editorial workflows.
- Support content moderation transitions and scheduled publishing.
- Set path aliases and assert the published state of content.
Several nodes of the same type can share a title. Steps that visit, modify or assert the published state of content by title resolve to the most recently created of them. Steps that delete content or assert it does not exist match every such node.
When the contribpathautomodule is enabled, the path alias step switches automatic alias generation off for the content, so the provided alias is preserved.
Prerequisites
| Prerequisite | Capability |
|---|---|
| A backend in the scenario's list provides "PathAliasCapabilityInterface" | PathAliasCapabilityInterface |
| The core "path" module is enabled, for the path alias step | ModuleCapabilityInterface |
Steps
@Given the content type :content_type does not exist
Delete content type
Given the content type "article" does not exist
@Given the following :content_type content does not exist:
Remove content defined by provided properties
Given the following "article" content does not exist:
| title |
| Test article |
| Another test article |
@Given the following :content_type content with fields exists:
Create content with vertical field format
Given the following page content with fields exists:
| title | [TEST] Page 1 | [TEST] Page 2 |
| body | First page content | Second page content |
| status | 1 | 1 |
@Given the following :content_type content exists:
Create content of a type from a table of field values
Given the following page content exists:
| title | status |
| [TEST] Page 1 | 1 |
| [TEST] Page 2 | 0 |
@When I visit the :content_type content page with the title :title
Visit a page of a type with a specified title
When I visit the "article" content page with the title "Test article"
@When I visit the :content_type content edit page with the title :title
Visit an edit page of a type with a specified title
When I visit the "article" content edit page with the title "Test article"
@When I visit the :content_type content delete page with the title :title
Visit a delete page of a type with a specified title
When I visit the "article" content delete page with the title "Test article"
@When I visit the :content_type content scheduled transitions page with the title :title
Visit a scheduled transitions page of a type with a specified title
When I visit the "article" content scheduled transitions page with the title "Test article"
@When I visit the :content_type content revisions page with the title :title
Visit a revisions page of a type with a specified title
When I visit the "article" content revisions page with the title "Test article"
@When the moderation state of the :content_type content with the title :title changes to the state :new_state
Change moderation state of a content with the specified title
When the moderation state of the "article" content with the title "Test article" changes to the state "published"
@When the access grants for the :content_type content with the title :title are rebuilt
Rebuild node access grants for a content with the specified title
When the access grants for the "article" content with the title "My article" are rebuilt
@When the access grants for all content are rebuilt
Rebuild node access grants for all content
When the access grants for all content are rebuilt
@When the path alias of the :content_type content with the title :title is set to :alias
Set the path alias of a content with the specified title
When the path alias of the "article" content with the title "Test article" is set to "/my-test-article"
@Then the :content_type content with the title :title should not exist
Assert content with specified type and title does not exist
Then the "page" content with the title "Test page" should not exist
Then the "article" content with the title "Test article" should not exist
@Then the :content_type content with the title :title should be published
Assert content with specified type and title is published
Then the "page" content with the title "Test page" should be published
@Then the :content_type content with the title :title should not be published
Assert content with specified type and title is not published
Then the "page" content with the title "Test page" should not be published