Code Duplication    Length = 24-25 lines in 2 locations

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

@@ 190-213 (lines=24) @@
187
     * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testNewUserGroupCreateStruct
188
     * @depends eZ\Publish\API\Repository\Tests\ContentTypeServiceTest::testLoadContentTypeByIdentifier
189
     */
190
    public function testNewUserGroupCreateStructWithSecondParameter()
191
    {
192
        if ($this->isVersion4()) {
193
            $this->markTestSkipped('This test is only relevant for eZ Publish versions > 4');
194
        }
195
196
        $repository = $this->getRepository();
197
198
        /* BEGIN: Use Case */
199
        $contentTypeService = $repository->getContentTypeService();
200
        $userService = $repository->getUserService();
201
202
        // Load the default ContentType for user groups
203
        $groupType = $contentTypeService->loadContentTypeByIdentifier('user_group');
204
205
        // Instantiate a new group create struct
206
        $groupCreate = $userService->newUserGroupCreateStruct(
207
            'eng-US',
208
            $groupType
209
        );
210
        /* END: Use Case */
211
212
        $this->assertSame($groupType, $groupCreate->contentType);
213
    }
214
215
    /**
216
     * Test for the createUserGroup() method.
@@ 894-918 (lines=25) @@
891
     * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testNewUserCreateStruct
892
     * @depends eZ\Publish\API\Repository\Tests\ContentTypeServiceTest::testLoadContentTypeByIdentifier
893
     */
894
    public function testNewUserCreateStructWithFifthParameter()
895
    {
896
        if ($this->isVersion4()) {
897
            $this->markTestSkipped('This test is only relevant for eZ Publish versions > 4');
898
        }
899
900
        $repository = $this->getRepository();
901
902
        /* BEGIN: Use Case */
903
        $contentTypeService = $repository->getContentTypeService();
904
        $userService = $repository->getUserService();
905
906
        $userType = $contentTypeService->loadContentTypeByIdentifier('user');
907
908
        $userCreate = $userService->newUserCreateStruct(
909
            'user',
910
            '[email protected]',
911
            'secret',
912
            'eng-US',
913
            $userType
914
        );
915
        /* END: Use Case */
916
917
        $this->assertSame($userType, $userCreate->contentType);
918
    }
919
920
    /**
921
     * Test for the createUser() method.