Code Duplication    Length = 17-19 lines in 2 locations

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

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

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

@@ 1716-1734 (lines=19) @@
1713
     * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException
1714
     * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testAssignUserToUserGroup
1715
     */
1716
    public function testAssignUserToUserGroupThrowsInvalidArgumentException()
1717
    {
1718
        $repository = $this->getRepository();
1719
        $userService = $repository->getUserService();
1720
1721
        $editorsGroupId = $this->generateId('group', 13);
1722
        /* BEGIN: Use Case */
1723
        $user = $this->createUserVersion1();
1724
        // $editorsGroupId is the ID of the "Editors" group in an
1725
        // eZ Publish demo installation
1726
1727
        // This call will fail with an "InvalidArgumentException", because the
1728
        // user is already assigned to the "Editors" group
1729
        $userService->assignUserToUserGroup(
1730
            $user,
1731
            $userService->loadUserGroup($editorsGroupId)
1732
        );
1733
        /* END: Use Case */
1734
    }
1735
1736
    /**
1737
     * Test for the unAssignUssrFromUserGroup() method.