Code Duplication    Length = 15-16 lines in 3 locations

tests/services/UserGroupsTest.php 3 locations

@@ 67-81 (lines=15) @@
64
     *
65
     * @param array $groupDefinitions
66
     */
67
    public function testSuccessfulImport(array $groupDefinitions)
68
    {
69
        $this->setMockUserGroupsService();
70
        $this->setMockUserPermissionsService();
71
        $this->setMockSectionsService('handle');
72
        $this->setMockAssetSourcesService('handle');
73
        $this->setMockGlobalsService('handle');
74
75
        $schematicUserGroupsService = new UserGroups();
76
77
        $import = $schematicUserGroupsService->import($groupDefinitions);
78
79
        $this->assertTrue($import instanceof Result);
80
        $this->assertFalse($import->hasErrors());
81
    }
82
83
    /**
84
     * @covers ::import
@@ 89-104 (lines=16) @@
86
     *
87
     * @param array $groupDefinitions
88
     */
89
    public function testImportWhereSavingGroupFails(array $groupDefinitions)
90
    {
91
        $this->setMockUserGroupsService(false);
92
        $this->setMockUserPermissionsService();
93
        $this->setMockSectionsService('handle');
94
        $this->setMockAssetSourcesService('handle');
95
        $this->setMockGlobalsService('handle');
96
97
        $schematicUserGroupsService = new UserGroups();
98
        $import = $schematicUserGroupsService->import($groupDefinitions);
99
100
        $this->assertTrue($import instanceof Result);
101
        if (!empty($groupDefinitions)) {
102
            $this->assertTrue($import->hasErrors());
103
        }
104
    }
105
106
    /**
107
     * @covers ::import
@@ 112-126 (lines=15) @@
109
     *
110
     * @param array $groupDefinitions
111
     */
112
    public function testImportWithForceOption(array $groupDefinitions)
113
    {
114
        $this->setMockUserGroupsService();
115
        $this->setMockUserPermissionsService();
116
        $this->setMockSectionsService('handle');
117
        $this->setMockAssetSourcesService('handle');
118
        $this->setMockGlobalsService('handle');
119
120
        $schematicUserGroupsService = new UserGroups();
121
122
        $import = $schematicUserGroupsService->import($groupDefinitions, true);
123
124
        $this->assertTrue($import instanceof Result);
125
        $this->assertFalse($import->hasErrors());
126
    }
127
128
    //==============================================================================================================
129
    //==============================================  PROVIDERS  ===================================================