Code Duplication    Length = 24-25 lines in 2 locations

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

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