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

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