Code Duplication    Length = 21-23 lines in 2 locations

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.

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.