Code Duplication    Length = 24-25 lines in 2 locations

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

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