Neos\Flow\Tests\Behavior\Features\Bootstrap\SecurityOperationsTrait::iHaveTheFollowingPolicies PHP Метод

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

WARNING: If using this step definition, IT MUST RUN AS ABSOLUTELY FIRST STEP IN A SCENARIO!
public iHaveTheFollowingPolicies ( $string )
    public function iHaveTheFollowingPolicies($string)
    {
        if ($this->subProcess !== null) {
            // This check ensures that this statement is ran *before* a subprocess is opened; as the Policy.yaml
            // which is set here influences the Proxy Building Process.
            throw new \Exception('Step "I have the following policies:" must run as FIRST step in a scenario, because otherwise the proxy-classes are already built in the wrong manner!');
        }
        self::$testingPolicyPathAndFilename = $this->environment->getPathToTemporaryDirectory() . 'Policy.yaml';
        file_put_contents(self::$testingPolicyPathAndFilename, $string->getRaw());
        $configurationManager = $this->objectManager->get(ConfigurationManager::class);
        $configurations = ObjectAccess::getProperty($configurationManager, 'configurations', true);
        unset($configurations[ConfigurationManager::CONFIGURATION_PROCESSING_TYPE_POLICY]);
        ObjectAccess::setProperty($configurationManager, 'configurations', $configurations, true);
        $policyService = $this->objectManager->get(PolicyService::class);
        ObjectAccess::setProperty($policyService, 'initialized', false, true);
    }