From 6a2539c34dea2b16356aba4f85e0e0197a7c5b71 Mon Sep 17 00:00:00 2001 From: Tobias Reischmann <tobias.reischmann@wi.uni-muenster.de> Date: Wed, 28 Aug 2019 11:08:03 +0200 Subject: [PATCH] Fixed tests for duplication --- tests/workflow_activate_disable_duplicate_test.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/workflow_activate_disable_duplicate_test.php b/tests/workflow_activate_disable_duplicate_test.php index c04abec..401a053 100644 --- a/tests/workflow_activate_disable_duplicate_test.php +++ b/tests/workflow_activate_disable_duplicate_test.php @@ -85,7 +85,16 @@ class tool_lifecycle_workflow_activate_disable_duplicate_testcase extends workfl workflow_manager::handle_action(action::WORKFLOW_DUPLICATE, $this->workflow1->id); $workflows = workflow_manager::get_workflows(); $this->assertCount(4, $workflows); - $duplicate = array_pop($workflows); + + // Retrieve the duplicated workflow. + $duplicate = null; + $existingworkflowids = [$this->workflow1->id, $this->workflow2->id, $this->workflow3->id]; + foreach ($workflows as $workflow) { + if (!array_search($workflow->id, $existingworkflowids)) { + $duplicate = $workflow; + break; + } + } $this->assertEquals($this->workflow1->displaytitle, $duplicate->displaytitle); $workflow1stepcount = count(\tool_lifecycle\manager\step_manager::get_step_instances($this->workflow1->id)); $duplicatestepcount = count(\tool_lifecycle\manager\step_manager::get_step_instances($duplicate->id)); -- GitLab