|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the Sylius package. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Paweł Jędrzejewski |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
declare(strict_types=1); |
|
13
|
|
|
|
|
14
|
|
|
namespace spec\Sylius\Bundle\ThemeBundle\Configuration; |
|
15
|
|
|
|
|
16
|
|
|
use PhpSpec\ObjectBehavior; |
|
17
|
|
|
use Sylius\Bundle\ThemeBundle\Configuration\ConfigurationProcessorInterface; |
|
18
|
|
|
use Sylius\Bundle\ThemeBundle\Configuration\SymfonyConfigurationProcessor; |
|
19
|
|
|
use Symfony\Component\Config\Definition\ConfigurationInterface; |
|
20
|
|
|
use Symfony\Component\Config\Definition\Processor; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* @author Kamil Kokot <[email protected]> |
|
24
|
|
|
*/ |
|
25
|
|
|
final class SymfonyConfigurationProcessorSpec extends ObjectBehavior |
|
26
|
|
|
{ |
|
27
|
|
|
function let(ConfigurationInterface $configuration, Processor $processor): void |
|
28
|
|
|
{ |
|
29
|
|
|
$this->beConstructedWith($configuration, $processor); |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
function it_implements_configuration_processor_interface(): void |
|
33
|
|
|
{ |
|
34
|
|
|
$this->shouldImplement(ConfigurationProcessorInterface::class); |
|
35
|
|
|
} |
|
36
|
|
|
|
|
37
|
|
|
function it_proxies_configuration_processing_to_symfony_configuration_processor( |
|
38
|
|
|
ConfigurationInterface $configuration, |
|
39
|
|
|
Processor $processor |
|
40
|
|
|
): void { |
|
41
|
|
|
$processor |
|
42
|
|
|
->processConfiguration($configuration, [['name' => 'example/theme']]) |
|
43
|
|
|
->willReturn(['name' => 'example/theme']) |
|
44
|
|
|
; |
|
45
|
|
|
|
|
46
|
|
|
$this->process([['name' => 'example/theme']])->shouldReturn(['name' => 'example/theme']); |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
function it_does_not_catch_any_exception_thrown_by_symfony_configuration_processor( |
|
50
|
|
|
ConfigurationInterface $configuration, |
|
51
|
|
|
Processor $processor |
|
52
|
|
|
): void { |
|
53
|
|
|
$processor |
|
54
|
|
|
->processConfiguration($configuration, []) |
|
55
|
|
|
->willThrow(\Exception::class) |
|
56
|
|
|
; |
|
57
|
|
|
|
|
58
|
|
|
$this->shouldThrow(\Exception::class)->duringProcess([]); |
|
59
|
|
|
} |
|
60
|
|
|
} |
|
61
|
|
|
|