Code Duplication    Length = 21-23 lines in 2 locations

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

@@ 226-248 (lines=23) @@
223
     * @depends eZ\Publish\API\Repository\Tests\RepositoryTest::testGetUserService
224
     * @depends eZ\Publish\API\Repository\Tests\PermissionServiceTest::testSetCurrentUserReference
225
     */
226
    public function testHasAccessLimited()
227
    {
228
        $repository = $this->getRepository();
229
230
        /* BEGIN: Use Case */
231
        $user = $this->createUserVersion1();
232
233
        $permissionService = $repository->getPermissionService();
234
235
        // Set created user as current user reference
236
        $permissionService->setCurrentUserReference($user);
237
238
        // This call will return an array of permission sets describing user's access
239
        // to reading content
240
        $permissionSets = $permissionService->hasAccess('content', 'read');
241
        /* END: Use Case */
242
243
        $this->assertInternalType(
244
            'array',
245
            $permissionSets
246
        );
247
        $this->assertNotEmpty($permissionSets);
248
    }
249
250
    /**
251
     * Test for the canUser() method.

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

@@ 507-527 (lines=21) @@
504
     * @depends eZ\Publish\API\Repository\Tests\RepositoryTest::testGetUserService
505
     * @depends eZ\Publish\API\Repository\Tests\RepositoryTest::testSetCurrentUser
506
     */
507
    public function testHasAccessLimited()
508
    {
509
        $repository = $this->getRepository();
510
511
        /* BEGIN: Use Case */
512
        $user = $this->createUserVersion1();
513
514
        // Set created user as current user
515
        $repository->setCurrentUser($user);
516
517
        // This call will return an array of permission sets describing user's access
518
        // to reading content
519
        $permissionSets = $repository->hasAccess('content', 'read');
520
        /* END: Use Case */
521
522
        $this->assertInternalType(
523
            'array',
524
            $permissionSets
525
        );
526
        $this->assertNotEmpty($permissionSets);
527
    }
528
529
    /**
530
     * Test for the canUser() method.