Code Duplication    Length = 24-25 lines in 2 locations

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

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