Code Duplication    Length = 24-25 lines in 2 locations

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

@@ 156-179 (lines=24) @@
153
     * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testNewUserGroupCreateStruct
154
     * @depends eZ\Publish\API\Repository\Tests\ContentTypeServiceTest::testLoadContentTypeByIdentifier
155
     */
156
    public function testNewUserGroupCreateStructWithSecondParameter()
157
    {
158
        if ($this->isVersion4()) {
159
            $this->markTestSkipped('This test is only relevant for eZ Publish versions > 4');
160
        }
161
162
        $repository = $this->getRepository();
163
164
        /* BEGIN: Use Case */
165
        $contentTypeService = $repository->getContentTypeService();
166
        $userService = $repository->getUserService();
167
168
        // Load the default ContentType for user groups
169
        $groupType = $contentTypeService->loadContentTypeByIdentifier('user_group');
170
171
        // Instantiate a new group create struct
172
        $groupCreate = $userService->newUserGroupCreateStruct(
173
            'eng-US',
174
            $groupType
175
        );
176
        /* END: Use Case */
177
178
        $this->assertSame($groupType, $groupCreate->contentType);
179
    }
180
181
    /**
182
     * Test for the createUserGroup() method.
@@ 773-797 (lines=25) @@
770
     * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testNewUserCreateStruct
771
     * @depends eZ\Publish\API\Repository\Tests\ContentTypeServiceTest::testLoadContentTypeByIdentifier
772
     */
773
    public function testNewUserCreateStructWithFifthParameter()
774
    {
775
        if ($this->isVersion4()) {
776
            $this->markTestSkipped('This test is only relevant for eZ Publish versions > 4');
777
        }
778
779
        $repository = $this->getRepository();
780
781
        /* BEGIN: Use Case */
782
        $contentTypeService = $repository->getContentTypeService();
783
        $userService = $repository->getUserService();
784
785
        $userType = $contentTypeService->loadContentTypeByIdentifier('user');
786
787
        $userCreate = $userService->newUserCreateStruct(
788
            'user',
789
            '[email protected]',
790
            'secret',
791
            'eng-US',
792
            $userType
793
        );
794
        /* END: Use Case */
795
796
        $this->assertSame($userType, $userCreate->contentType);
797
    }
798
799
    /**
800
     * Test for the createUser() method.