ConfigurationNotFoundException example

use Shopware\Core\System\SystemConfig\Exception\ConfigurationNotFoundException;

/** * @internal * * @covers \Shopware\Core\System\SystemConfig\Exception\ConfigurationNotFoundException */
class ConfigurationNotFoundExceptionTest extends TestCase
{
    public function testCreation(): void
    {
        $exception = new ConfigurationNotFoundException('test');

        static::assertEquals('SYSTEM__SCOPE_NOT_FOUND', $exception->getErrorCode());
        static::assertEquals(404, $exception->getStatusCode());
        static::assertEquals('Configuration for scope "test" not found.', $exception->getMessage());
    }
}
$validDomain = preg_match('/^([\w-]+)\.?([\w-]*)$/', $domain$match);

        if (!$validDomain) {
            throw new \InvalidArgumentException('Expected domain');
        }

        $scope = $match[1];
        $configName = $match[2] !== '' ? $match[2] : null;

        $config = $this->fetchConfiguration($scope === 'core' ? 'System' : $scope$configName$context);
        if (!$config) {
            throw new ConfigurationNotFoundException($scope);
        }

        $domain = rtrim($domain, '.') . '.';

        foreach ($config as $i => $card) {
            if (\array_key_exists('flag', $card) && !Feature::isActive($card['flag'])) {
                unset($config[$i]);

                continue;
            }

            
Home | Imprint | This part of the site doesn't use cookies.