Code Duplication    Length = 21-23 lines in 2 locations

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

@@ 531-551 (lines=21) @@
528
     * @depends eZ\Publish\API\Repository\Tests\RepositoryTest::testGetUserService
529
     * @depends eZ\Publish\API\Repository\Tests\RepositoryTest::testSetCurrentUser
530
     */
531
    public function testHasAccessLimited()
532
    {
533
        $repository = $this->getRepository();
534
535
        /* BEGIN: Use Case */
536
        $user = $this->createUserVersion1();
537
538
        // Set created user as current user
539
        $repository->setCurrentUser($user);
540
541
        // This call will return an array of permission sets describing user's access
542
        // to reading content
543
        $permissionSets = $repository->hasAccess('content', 'read');
544
        /* END: Use Case */
545
546
        $this->assertInternalType(
547
            'array',
548
            $permissionSets
549
        );
550
        $this->assertNotEmpty($permissionSets);
551
    }
552
553
    /**
554
     * Test for the canUser() method.

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

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