Skip to content

Commit

Permalink
Added utility class to ignore SA configuration (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamwojs authored Mar 18, 2024
1 parent fb5568b commit d6a6b06
Showing 1 changed file with 41 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

/**
* @copyright Copyright (C) Ibexa AS. All rights reserved.
* @license For full copyright and license information view LICENSE file distributed with this source code.
*/
declare(strict_types=1);

namespace Ibexa\Contracts\Test\Core\DependencyInjection\Configuration\SiteAccessAware;

use Ibexa\Bundle\Core\DependencyInjection\Configuration\AbstractParser;
use Ibexa\Bundle\Core\DependencyInjection\Configuration\SiteAccessAware\ContextualizerInterface;
use Symfony\Component\Config\Definition\Builder\NodeBuilder;

/**
* SA configuration parser which allows ignoring given keys in tests.
*/
final class IgnoredConfigParser extends AbstractParser
{
/** @var string[] */
private array $keys;

public function __construct(string ...$keys)
{
$this->keys = $keys;
}

public function addSemanticConfig(NodeBuilder $nodeBuilder): void
{
foreach ($this->keys as $key) {
$nodeBuilder->variableNode($key)->defaultNull()->end();
}
}

/**
* @param array<string,mixed> $scopeSettings
*/
public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer): void
{
}
}

0 comments on commit d6a6b06

Please sign in to comment.