eZ\Publish\Core\Repository\Tests\Service\Integration\RoleBase::testUpdatePolicy PHP Метод

testUpdatePolicy() публичный Метод

Test updating policies of a role, depends on proper eZ Publish clean data which has a number of policies and limitations applied to Anonymous role.
public testUpdatePolicy ( )
    public function testUpdatePolicy()
    {
        $roleService = $this->repository->getRoleService();
        $role = $roleService->loadRole(1);
        $policies = $role->getPolicies();
        $policy = $policies[0];
        // Verify we get correct data from backend
        self::assertEquals('content', $policy->module);
        self::assertEquals('read', $policy->function);
        $limitation = new Limitation\ContentTypeLimitation();
        $limitation->limitationValues = array('1', '3', '13');
        $policyUpdateStruct = $roleService->newPolicyUpdateStruct();
        $policyUpdateStruct->addLimitation($limitation);
        $updatedPolicy = $roleService->updatePolicy($policy, $policyUpdateStruct);
        $this->assertPropertiesCorrect(array('id' => $policy->id, 'roleId' => $policy->roleId, 'module' => $policy->module, 'function' => $policy->function), $updatedPolicy);
        $limitations = $updatedPolicy->getLimitations();
        self::assertCount(1, $limitations);
        self::assertInstanceOf('\\eZ\\Publish\\API\\Repository\\Values\\User\\Limitation', $limitations[0]);
        self::assertEquals(Limitation::CONTENTTYPE, $limitations[0]->getIdentifier());
        self::assertEquals($limitation->limitationValues, $limitations[0]->limitationValues);
    }