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

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