getLaw(); $anonymUserSource = new UserSource(); EntityTemplateFactory::createStandartPublicRights($source); $requestedRight = new Right(); $requestedRight->setReciever($anonymUserSource); $lawPermissionChecker = new LawPermissionChecker($law); foreach (LayerType::getValues() as $layerType) { foreach (ActionType::getValues() as $actionType) { $requestedRight->setActionType($actionType); $requestedRight->setLayer($layerType); $checkResult = $lawPermissionChecker->hasPermission($requestedRight); if (in_array($actionType, $allowedActions) && in_array($layerType, $allowedLayers)) { $this->assertTrue($checkResult); } else { $this->assertFalse($checkResult); } } } } }