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

@@ 2046-2064 (lines=19) @@
2043
     * @expectedExceptionMessage Argument 'user' is invalid: user is already in the given user group
2044
     * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testAssignUserToUserGroup
2045
     */
2046
    public function testAssignUserToUserGroupThrowsInvalidArgumentException()
2047
    {
2048
        $repository = $this->getRepository();
2049
        $userService = $repository->getUserService();
2050
2051
        $editorsGroupId = $this->generateId('group', 13);
2052
        /* BEGIN: Use Case */
2053
        $user = $this->createUserVersion1();
2054
        // $editorsGroupId is the ID of the "Editors" group in an
2055
        // eZ Publish demo installation
2056
2057
        // This call will fail with an "InvalidArgumentException", because the
2058
        // user is already assigned to the "Editors" group
2059
        $userService->assignUserToUserGroup(
2060
            $user,
2061
            $userService->loadUserGroup($editorsGroupId)
2062
        );
2063
        /* END: Use Case */
2064
    }
2065
2066
    /**
2067
     * Test for the unAssignUssrFromUserGroup() method.