From 1bf85c5ef53abc7db1f4e388445fc16f92944c19 Mon Sep 17 00:00:00 2001 From: Bec White Date: Tue, 20 Oct 2015 14:40:23 -0500 Subject: [PATCH] Add tags for disabling auto_nodetitle and workbench_moderation during particular tests. --- .../Context/DrupalAutoNodetitleContext.php | 46 +++++++++++++++++ .../DrupalWorkbenchModerationContext.php | 50 +++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 src/Palantirnet/PalantirBehatExtension/Context/DrupalAutoNodetitleContext.php create mode 100644 src/Palantirnet/PalantirBehatExtension/Context/DrupalWorkbenchModerationContext.php diff --git a/src/Palantirnet/PalantirBehatExtension/Context/DrupalAutoNodetitleContext.php b/src/Palantirnet/PalantirBehatExtension/Context/DrupalAutoNodetitleContext.php new file mode 100644 index 0000000..d7f7050 --- /dev/null +++ b/src/Palantirnet/PalantirBehatExtension/Context/DrupalAutoNodetitleContext.php @@ -0,0 +1,46 @@ +disableAutoNodetitle = TRUE; + } + + /** + * @BeforeNodeCreate + */ + public function prepareAutoNodetitleNode(BeforeNodeCreateScope $scope) + { + if ($this->disableAutoNodetitle) { + $node = $scope->getEntity(); + $node->auto_nodetitle_applied = TRUE; + } + } + +} diff --git a/src/Palantirnet/PalantirBehatExtension/Context/DrupalWorkbenchModerationContext.php b/src/Palantirnet/PalantirBehatExtension/Context/DrupalWorkbenchModerationContext.php new file mode 100644 index 0000000..0f98b9d --- /dev/null +++ b/src/Palantirnet/PalantirBehatExtension/Context/DrupalWorkbenchModerationContext.php @@ -0,0 +1,50 @@ +disableWorkbenchModeration = TRUE; + } + + /** + * @BeforeNodeCreate + */ + public function prepareWorkbenchModerationNode(BeforeNodeCreateScope $scope) + { + if ($this->disableWorkbenchModeration) { + $node = $scope->getEntity(); + $node->status = 1; + + // This is a hack; workbench_moderation_node_update() will return + // without applying moderation if it thinks that it is being called + // recursively. + $node->updating_live_revision = 'behat_skip'; + } + } + +}