Code Duplication    Length = 32-32 lines in 2 locations

eZ/Publish/Core/Repository/Tests/Service/Integration/Base.php 1 location

@@ 67-98 (lines=32) @@
64
    /**
65
     * @return \eZ\Publish\Core\Repository\Values\User\User
66
     */
67
    protected function createUserVersion1()
68
    {
69
        $repository = $this->repository;
70
71
        /* BEGIN: Inline */
72
        // ID of the "Editors" user group in an eZ Publish demo installation
73
        $editorsGroupId = 13;
74
75
        $userService = $repository->getUserService();
76
77
        // Instantiate a create struct with mandatory properties
78
        $userCreate = $userService->newUserCreateStruct(
79
            'user',
80
            '[email protected]',
81
            'secret',
82
            'eng-US'
83
        );
84
        $userCreate->enabled = true;
85
86
        // Set some fields required by the user ContentType
87
        $userCreate->setField('first_name', 'Example');
88
        $userCreate->setField('last_name', 'User');
89
90
        // Load parent group for the user
91
        $group = $userService->loadUserGroup($editorsGroupId);
92
93
        // Create a new user instance.
94
        $user = $userService->createUser($userCreate, array($group));
95
        /* END: Inline */
96
97
        return $user;
98
    }
99
100
    /**
101
     * Tear down test (properties).

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

@@ 279-310 (lines=32) @@
276
     *
277
     * @return \eZ\Publish\API\Repository\Values\User\User
278
     */
279
    protected function createUserVersion1($login = 'user')
280
    {
281
        $repository = $this->getRepository();
282
283
        /* BEGIN: Inline */
284
        // ID of the "Editors" user group in an eZ Publish demo installation
285
        $editorsGroupId = 13;
286
287
        $userService = $repository->getUserService();
288
289
        // Instantiate a create struct with mandatory properties
290
        $userCreate = $userService->newUserCreateStruct(
291
            $login,
292
            "{$login}@example.com",
293
            'secret',
294
            'eng-US'
295
        );
296
        $userCreate->enabled = true;
297
298
        // Set some fields required by the user ContentType
299
        $userCreate->setField('first_name', 'Example');
300
        $userCreate->setField('last_name', 'User');
301
302
        // Load parent group for the user
303
        $group = $userService->loadUserGroup($editorsGroupId);
304
305
        // Create a new user instance.
306
        $user = $userService->createUser($userCreate, array($group));
307
        /* END: Inline */
308
309
        return $user;
310
    }
311
312
    /**
313
     * Create a user in new user group with editor rights limited to Media Library (/1/48/).