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

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