ekino /
drupal-debug
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | /* |
||
| 6 | * This file is part of the ekino Drupal Debug project. |
||
| 7 | * |
||
| 8 | * (c) ekino |
||
| 9 | * |
||
| 10 | * For the full copyright and license information, please view the LICENSE |
||
| 11 | * file that was distributed with this source code. |
||
| 12 | */ |
||
| 13 | |||
| 14 | namespace Ekino\Drupal\Debug\Configuration; |
||
| 15 | |||
| 16 | use Ekino\Drupal\Debug\Configuration\Model\DefaultsConfiguration as DefaultsConfigurationModel; |
||
| 17 | use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; |
||
| 18 | use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
||
| 19 | |||
| 20 | class SubstituteOriginalDrupalKernelConfiguration extends AbstractConfiguration |
||
| 21 | { |
||
| 22 | /** |
||
| 23 | * @var string |
||
| 24 | */ |
||
| 25 | public const ROOT_KEY = 'substitute_original_drupal_kernel'; |
||
| 26 | |||
| 27 | private $defaultsConfiguration; |
||
| 28 | |||
| 29 | 19 | public function __construct(DefaultsConfigurationModel $defaultsConfiguration) |
|
| 30 | { |
||
| 31 | 19 | $this->defaultsConfiguration = $defaultsConfiguration; |
|
| 32 | 19 | } |
|
| 33 | |||
| 34 | /** |
||
| 35 | * {@inheritdoc} |
||
| 36 | */ |
||
| 37 | 19 | public function getArrayNodeDefinition(TreeBuilder $treeBuilder): ArrayNodeDefinition |
|
| 38 | { |
||
| 39 | /** @var ArrayNodeDefinition $rootNode */ |
||
| 40 | 19 | $rootNode = $treeBuilder->root(self::ROOT_KEY); |
|
| 41 | |||
| 42 | $rootNode |
||
| 43 | 19 | ->info("It is recommended to disable the original DrupalKernel substitution to run your tests.\nTo programmatically toggle it, use the two dedicated composer commands.") |
|
| 44 | 19 | ->canBeDisabled() |
|
| 45 | 19 | ->children() |
|
| 46 | 19 | ->scalarNode('composer_autoload_file_path') |
|
| 47 | 19 | ->cannotBeEmpty() |
|
| 48 | 19 | ->defaultValue('vendor/autoload.php') |
|
| 49 | 19 | ->end() |
|
| 50 | 19 | ->scalarNode('cache_directory_path') |
|
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 51 | 19 | ->info('If not specified, it fall backs to the default cache directory path.') |
|
| 52 | 19 | ->defaultValue($this->defaultsConfiguration->getCacheDirectoryPath()) |
|
| 53 | 19 | ->end() |
|
| 54 | 19 | ->end(); |
|
| 55 | |||
| 56 | 19 | return $rootNode; |
|
| 57 | } |
||
| 58 | } |
||
| 59 |