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

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