Code Duplication    Length = 21-23 lines in 2 locations

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

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

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

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