Code Duplication    Length = 21-23 lines in 2 locations

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

@@ 514-534 (lines=21) @@
511
     * @depends eZ\Publish\API\Repository\Tests\RepositoryTest::testGetUserService
512
     * @depends eZ\Publish\API\Repository\Tests\RepositoryTest::testSetCurrentUser
513
     */
514
    public function testHasAccessLimited()
515
    {
516
        $repository = $this->getRepository();
517
518
        /* BEGIN: Use Case */
519
        $user = $this->createUserVersion1();
520
521
        // Set created user as current user
522
        $repository->setCurrentUser($user);
523
524
        // This call will return an array of permission sets describing user's access
525
        // to reading content
526
        $permissionSets = $repository->hasAccess('content', 'read');
527
        /* END: Use Case */
528
529
        $this->assertInternalType(
530
            'array',
531
            $permissionSets
532
        );
533
        $this->assertNotEmpty($permissionSets);
534
    }
535
536
    /**
537
     * 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.