Code Duplication    Length = 24-25 lines in 2 locations

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

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