generateConfigBuilder example

$basePath = __DIR__.'/Fixtures/';
        $callback = include $basePath.$name.'.config.php';
        $expectedOutput = include $basePath.$name.'.output.php';
        $expectedCode = $basePath.$name;

        // to regenerate snapshot files, uncomment these lines         // (new Filesystem())->remove($expectedCode);         // $this->generateConfigBuilder('Symfony\\Component\\Config\\Tests\\Builder\\Fixtures\\'.$name, $expectedCode);         // $this->markTestIncomplete('Re-comment the line above and relaunch the tests');
        $outputDir = sys_get_temp_dir().\DIRECTORY_SEPARATOR.uniqid('sf_config_builder', true);
        $configBuilder = $this->generateConfigBuilder('Symfony\\Component\\Config\\Tests\\Builder\\Fixtures\\'.$name$outputDir);
        $callback($configBuilder);

        $this->assertDirectorySame($expectedCode$outputDir);

        $this->assertInstanceOf(ConfigBuilderInterface::class$configBuilder);
        $this->assertSame($alias$configBuilder->getExtensionAlias());
        $output = $configBuilder->toArray();
        if (class_exists(AbstractConfigurator::class)) {
            $output = AbstractConfigurator::processValue($output);
        }
        $this->assertSame($expectedOutput$output);
    }
Home | Imprint | This part of the site doesn't use cookies.