Code Duplication    Length = 17-19 lines in 2 locations

eZ/Publish/API/Repository/Tests/Values/User/Limitation/UserGroupLimitationTest.php 1 location

@@ 63-79 (lines=17) @@
60
     *
61
     * @throws \ErrorException if a mandatory test fixture not exists.
62
     */
63
    public function testUserGroupLimitationForbid()
64
    {
65
        $repository = $this->getRepository();
66
67
        $userService = $repository->getUserService();
68
69
        /* BEGIN: Use Case */
70
        $user = $this->createUserVersion1();
71
72
        $userGroup = $this->prepareUserGroup();
73
74
        // Assign example user to new group
75
        $userService->assignUserToUserGroup($user, $userGroup);
76
77
        $this->prepareLimitationAndContent($user, $userGroup);
78
        /* END: Use Case */
79
    }
80
81
    /**
82
     * Prepares the UserGroup fixture.

eZ/Publish/API/Repository/Tests/UserServiceTest.php 1 location

@@ 1883-1901 (lines=19) @@
1880
     * @expectedExceptionMessage Argument 'user' is invalid: user is already in the given user group
1881
     * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testAssignUserToUserGroup
1882
     */
1883
    public function testAssignUserToUserGroupThrowsInvalidArgumentException()
1884
    {
1885
        $repository = $this->getRepository();
1886
        $userService = $repository->getUserService();
1887
1888
        $editorsGroupId = $this->generateId('group', 13);
1889
        /* BEGIN: Use Case */
1890
        $user = $this->createUserVersion1();
1891
        // $editorsGroupId is the ID of the "Editors" group in an
1892
        // eZ Publish demo installation
1893
1894
        // This call will fail with an "InvalidArgumentException", because the
1895
        // user is already assigned to the "Editors" group
1896
        $userService->assignUserToUserGroup(
1897
            $user,
1898
            $userService->loadUserGroup($editorsGroupId)
1899
        );
1900
        /* END: Use Case */
1901
    }
1902
1903
    /**
1904
     * Test for the unAssignUssrFromUserGroup() method.