KnpU\OAuth2ClientBundle\Tests\DependencyInjection\KnpUOAuth2ClientExtensionTest::provideTypesAndConfig PHP Method

provideTypesAndConfig() public method

    public function provideTypesAndConfig()
    {
        $tests = [];
        $extension = new KnpUOAuth2ClientExtension();
        foreach (KnpUOAuth2ClientExtension::getAllSupportedTypes() as $type) {
            $configurator = $extension->getConfigurator($type);
            $tree = new TreeBuilder();
            $configNode = $tree->root('testing');
            $configurator->buildConfiguration($configNode->children(), $type);
            /** @var ArrayNode $arrayNode */
            $arrayNode = $tree->buildTree();
            $config = ['client_id' => 'CLIENT_ID_TEST', 'client_secret' => 'CLIENT_SECRET_TEST', 'redirect_route' => 'go_there', 'redirect_params' => [], 'use_state' => rand(0, 1) == 0];
            // loop through and assign some random values
            foreach ($arrayNode->getChildren() as $child) {
                /** @var NodeInterface $child */
                if ($child instanceof ArrayNode) {
                    $config[$child->getName()] = [];
                } else {
                    $config[$child->getName()] = rand();
                }
            }
            $tests[] = [$type, $config];
        }
        return $tests;
    }