-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request from GHSA-prg5-hg25-8grq
Security fix for "Ability to switch channels via GET parameter enabled in production environments"
- Loading branch information
Showing
3 changed files
with
65 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
src/Sylius/Bundle/ChannelBundle/Tests/DependencyInjection/SyliusChannelExtensionTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Paweł Jędrzejewski | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sylius\Bundle\ChannelBundle\Tests\DependencyInjection; | ||
|
||
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase; | ||
use Sylius\Bundle\ChannelBundle\DependencyInjection\SyliusChannelExtension; | ||
|
||
final class SyliusChannelExtensionTest extends AbstractExtensionTestCase | ||
{ | ||
/** @test */ | ||
public function it_fallbacks_to_enabled_kernel_debug_parameter_if_debug_is_not_defined(): void | ||
{ | ||
$this->container->setParameter('kernel.debug', true); | ||
|
||
$this->load([]); | ||
|
||
$this->assertContainerBuilderHasServiceDefinitionWithArgument('sylius.channel_collector', 2, true); | ||
} | ||
|
||
/** @test */ | ||
public function it_fallbacks_to_disabled_kernel_debug_parameter_if_debug_is_not_defined(): void | ||
{ | ||
$this->container->setParameter('kernel.debug', false); | ||
|
||
$this->load([]); | ||
|
||
$this->assertContainerBuilderHasServiceDefinitionWithArgument('sylius.channel_collector', 2, false); | ||
} | ||
|
||
/** @test */ | ||
public function it_uses_enabled_debug_config_if_defined(): void | ||
{ | ||
$this->load(['debug' => true]); | ||
|
||
$this->assertContainerBuilderHasServiceDefinitionWithArgument('sylius.channel_collector', 2, true); | ||
} | ||
|
||
/** @test */ | ||
public function it_uses_disabled_debug_config_if_defined(): void | ||
{ | ||
$this->load(['debug' => false]); | ||
|
||
$this->assertContainerBuilderHasServiceDefinitionWithArgument('sylius.channel_collector', 2, false); | ||
} | ||
|
||
protected function getContainerExtensions(): array | ||
{ | ||
return [ | ||
new SyliusChannelExtension(), | ||
]; | ||
} | ||
} |