Code Duplication    Length = 24-25 lines in 2 locations

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

@@ 239-262 (lines=24) @@
236
     * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testNewUserGroupCreateStruct
237
     * @depends eZ\Publish\API\Repository\Tests\ContentTypeServiceTest::testLoadContentTypeByIdentifier
238
     */
239
    public function testNewUserGroupCreateStructWithSecondParameter()
240
    {
241
        if ($this->isVersion4()) {
242
            $this->markTestSkipped('This test is only relevant for eZ Publish versions > 4');
243
        }
244
245
        $repository = $this->getRepository();
246
247
        /* BEGIN: Use Case */
248
        $contentTypeService = $repository->getContentTypeService();
249
        $userService = $repository->getUserService();
250
251
        // Load the default ContentType for user groups
252
        $groupType = $contentTypeService->loadContentTypeByIdentifier('user_group');
253
254
        // Instantiate a new group create struct
255
        $groupCreate = $userService->newUserGroupCreateStruct(
256
            'eng-US',
257
            $groupType
258
        );
259
        /* END: Use Case */
260
261
        $this->assertSame($groupType, $groupCreate->contentType);
262
    }
263
264
    /**
265
     * Test for the createUserGroup() method.
@@ 851-875 (lines=25) @@
848
     * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testNewUserCreateStruct
849
     * @depends eZ\Publish\API\Repository\Tests\ContentTypeServiceTest::testLoadContentTypeByIdentifier
850
     */
851
    public function testNewUserCreateStructWithFifthParameter()
852
    {
853
        if ($this->isVersion4()) {
854
            $this->markTestSkipped('This test is only relevant for eZ Publish versions > 4');
855
        }
856
857
        $repository = $this->getRepository();
858
859
        /* BEGIN: Use Case */
860
        $contentTypeService = $repository->getContentTypeService();
861
        $userService = $repository->getUserService();
862
863
        $userType = $contentTypeService->loadContentTypeByIdentifier('user');
864
865
        $userCreate = $userService->newUserCreateStruct(
866
            'user',
867
            '[email protected]',
868
            'secret',
869
            'eng-US',
870
            $userType
871
        );
872
        /* END: Use Case */
873
874
        $this->assertSame($userType, $userCreate->contentType);
875
    }
876
877
    /**
878
     * Test for creating user with Active Directory login name.