Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added an AfterScenario for ParagraphsTrait #71

Merged

Conversation

joshua1234511
Copy link
Contributor

Added an AfterScenario for ParagraphsTrait, to delete all paragraph created using this trait.

Use case

  • When paragraph are created using a specific uuid value, the next run the entities are not deleted and unique integrity violation error is given.

 to delete all paragraph created using this trait.
@AlexSkrypnyk AlexSkrypnyk added this to the 0.3.0 milestone Jul 17, 2021
*
* @var array
*/
protected $paragraph = [];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

protected static $paragraphs = [];

*
* @AfterScenario
*/
public function paragraphCleanAll(AfterScenarioScope $scope) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public function paragraphsCleanAll(AfterScenarioScope $scope) {

return;
}

foreach ($this->paragraph as $paragraph) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

foreach (static::$paragraphs as $paragraph) {

@@ -80,6 +111,7 @@ protected function paragraphsAttachFromStubToEntity(ContentEntityInterface $enti
'target_revision_id' => $paragraph->getRevisionId(),
];
$entity->set($entity_field_name, $new_value)->save();
$this->paragraph[] = $paragraph;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static::$paragraphs[] = $paragraph;

@AlexSkrypnyk
Copy link
Member

@joshua1234511
Thank you for your contribution!

Minor changes are required, but I will make them after this PR is merged to speed up the delivery.

@AlexSkrypnyk AlexSkrypnyk enabled auto-merge (squash) July 17, 2021 01:05
@AlexSkrypnyk AlexSkrypnyk merged commit a9335c5 into drevops:master Jul 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants