Skip to content

Commit

Permalink
Fix phpunit
Browse files Browse the repository at this point in the history
  • Loading branch information
loevgaard committed Jan 13, 2025
1 parent 38da9a9 commit e06887d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
7 changes: 0 additions & 7 deletions src/DependencyInjection/SetonoConsentExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Alias;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;

Expand All @@ -33,12 +32,6 @@ public function load(array $configs, ContainerBuilder $container): void

$container->setParameter('setono_consent.consents', $consents);

// validate the consent checker
$consentChecker = $container->getDefinition($config['consent_checker']);
if (!is_a($consentChecker->getClass(), ConsentCheckerInterface::class, true)) {
throw new InvalidArgumentException(sprintf('The consent checker must implement %s', ConsentCheckerInterface::class));
}

$alias = new Alias($config['consent_checker']);
$alias->setDeprecated('setono/consent-bundle', '1.2', sprintf('The "%%alias_id%%" service is deprecated. You should use the "%s" alias instead.', ConsentCheckerInterface::class));

Check warning on line 36 in src/DependencyInjection/SetonoConsentExtension.php

View workflow job for this annotation

GitHub Actions / Mutation tests (8.2, highest)

Escaped Mutant for Mutator "MethodCallRemoval": --- Original +++ New @@ @@ $consents = array_merge([DefaultConsents::CONSENT_MARKETING => false, DefaultConsents::CONSENT_FUNCTIONAL => false, DefaultConsents::CONSENT_STATISTICAL => false], $config['consents']); $container->setParameter('setono_consent.consents', $consents); $alias = new Alias($config['consent_checker']); - $alias->setDeprecated('setono/consent-bundle', '1.2', sprintf('The "%%alias_id%%" service is deprecated. You should use the "%s" alias instead.', ConsentCheckerInterface::class)); + $container->setAlias('setono_consent.consent_checker.default', $alias); $container->setAlias(ConsentCheckerInterface::class, $config['consent_checker']); $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../../config'));

Expand Down
2 changes: 2 additions & 0 deletions tests/DependencyInjection/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Matthias\SymfonyConfigTest\PhpUnit\ConfigurationTestCaseTrait;
use PHPUnit\Framework\TestCase;
use Setono\ConsentBundle\Checker\StaticConsentChecker;
use Setono\ConsentBundle\DependencyInjection\Configuration;

/**
Expand Down Expand Up @@ -39,6 +40,7 @@ public function it_processes_configuration(): void
'statistics' => true,
'random' => true,
],
'consent_checker' => StaticConsentChecker::class,
]);
}
}

0 comments on commit e06887d

Please sign in to comment.