Code Duplication    Length = 24-25 lines in 2 locations

eZ/Publish/API/Repository/Tests/UserServiceTest.php 2 locations

@@ 201-224 (lines=24) @@
198
     * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testNewUserGroupCreateStruct
199
     * @depends eZ\Publish\API\Repository\Tests\ContentTypeServiceTest::testLoadContentTypeByIdentifier
200
     */
201
    public function testNewUserGroupCreateStructWithSecondParameter()
202
    {
203
        if ($this->isVersion4()) {
204
            $this->markTestSkipped('This test is only relevant for eZ Publish versions > 4');
205
        }
206
207
        $repository = $this->getRepository();
208
209
        /* BEGIN: Use Case */
210
        $contentTypeService = $repository->getContentTypeService();
211
        $userService = $repository->getUserService();
212
213
        // Load the default ContentType for user groups
214
        $groupType = $contentTypeService->loadContentTypeByIdentifier('user_group');
215
216
        // Instantiate a new group create struct
217
        $groupCreate = $userService->newUserGroupCreateStruct(
218
            'eng-US',
219
            $groupType
220
        );
221
        /* END: Use Case */
222
223
        $this->assertSame($groupType, $groupCreate->contentType);
224
    }
225
226
    /**
227
     * Test for the createUserGroup() method.
@@ 813-837 (lines=25) @@
810
     * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testNewUserCreateStruct
811
     * @depends eZ\Publish\API\Repository\Tests\ContentTypeServiceTest::testLoadContentTypeByIdentifier
812
     */
813
    public function testNewUserCreateStructWithFifthParameter()
814
    {
815
        if ($this->isVersion4()) {
816
            $this->markTestSkipped('This test is only relevant for eZ Publish versions > 4');
817
        }
818
819
        $repository = $this->getRepository();
820
821
        /* BEGIN: Use Case */
822
        $contentTypeService = $repository->getContentTypeService();
823
        $userService = $repository->getUserService();
824
825
        $userType = $contentTypeService->loadContentTypeByIdentifier('user');
826
827
        $userCreate = $userService->newUserCreateStruct(
828
            'user',
829
            '[email protected]',
830
            'secret',
831
            'eng-US',
832
            $userType
833
        );
834
        /* END: Use Case */
835
836
        $this->assertSame($userType, $userCreate->contentType);
837
    }
838
839
    /**
840
     * Test for creating user with Active Directory login name.