Code Duplication    Length = 32-32 lines in 2 locations

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

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

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).