diff --git a/classes/manager/workflow_manager.php b/classes/manager/workflow_manager.php
index a21c2cce83ecffd3d1cb86e986f020bdff692074..41cf88f53d1954399560fdbf354366db2d370545 100644
--- a/classes/manager/workflow_manager.php
+++ b/classes/manager/workflow_manager.php
@@ -353,14 +353,19 @@ class workflow_manager {
     }
 
     /**
-     * Creates a workflow with a specific title. Is used to create preset workflows for trigger plugins.
+     * Creates a workflow with a specific title. Is used to create preset workflows for trigger plugins or for
+     * duplication of workflows.
      *
-     * @param $title string title of the workflow. Usually the pluginname of the trigger.
+     * @param $title string title of the workflow.
+     * @param $displaytitle string display title of the workflow.
      * @return workflow the created workflow.
      */
-    public static function create_workflow($title) {
+    public static function create_workflow($title, $displaytitle = null) {
         $record = new \stdClass();
         $record->title = $title;
+        if (!is_null($displaytitle)) {
+            $record->displaytitle = $displaytitle;
+        }
         $workflow = workflow::from_record($record);
         self::insert_or_update($workflow);
         return $workflow;
@@ -379,7 +384,7 @@ class workflow_manager {
         } catch (\coding_exception $e) {
             $newtitle = $oldworkflow->title;
         }
-        $newworkflow = self::create_workflow($newtitle);
+        $newworkflow = self::create_workflow($newtitle, $oldworkflow->displaytitle);
         $newworkflow->rollbackdelay = $oldworkflow->rollbackdelay;
         $newworkflow->finishdelay = $oldworkflow->finishdelay;
         $newworkflow->delayforallworkflows = $oldworkflow->delayforallworkflows;
diff --git a/tests/generator/lib.php b/tests/generator/lib.php
index 4e7d7d79ed02693e6cf12a27d16c4f4ea5b84850..408733afebf5da182e84f9f9b5398d3f36f699cc 100644
--- a/tests/generator/lib.php
+++ b/tests/generator/lib.php
@@ -74,6 +74,7 @@ class tool_lifecycle_generator extends testing_module_generator {
         $record = new stdClass();
         $record->id = null;
         $record->title = 'myworkflow';
+        $record->displaytitle = 'random displaystring:' . random_string(10);
         $workflow = workflow::from_record($record);
         workflow_manager::insert_or_update($workflow);
         foreach ($stepnames as $subpluginname) {
diff --git a/tests/workflow_activate_disable_duplicate_test.php b/tests/workflow_activate_disable_duplicate_test.php
index 055dfb1baf16240ca61cffb9d0aeef90d8f982d9..401a0538b2dfbbfedb1a51d0db80bbc9517f27d9 100644
--- a/tests/workflow_activate_disable_duplicate_test.php
+++ b/tests/workflow_activate_disable_duplicate_test.php
@@ -74,7 +74,31 @@ class tool_lifecycle_workflow_activate_disable_duplicate_testcase extends workfl
      * Test to deactivate the first workflow.
      */
     public function test_deactivate_first() {
-        // TODO to be implemented.
+        workflow_manager::handle_action(action::WORKFLOW_ABORTDISABLE, $this->workflow1->id);
+        $this->assertFalse(workflow_manager::is_active($this->workflow1->id));
+    }
+
+    /**
+     * Test to duplicate the first workflow.
+     */
+    public function test_duplicate_first() {
+        workflow_manager::handle_action(action::WORKFLOW_DUPLICATE, $this->workflow1->id);
+        $workflows = workflow_manager::get_workflows();
+        $this->assertCount(4, $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));
+        $this->assertEquals($workflow1stepcount, $duplicatestepcount);
     }
 
 }