|
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 Sylius\Bundle\CoreBundle\Tests\Fixture; |
|
15
|
|
|
|
|
16
|
|
|
use Doctrine\Common\Persistence\ObjectManager; |
|
17
|
|
|
use Matthias\SymfonyConfigTest\PhpUnit\ConfigurationTestCaseTrait; |
|
18
|
|
|
use PHPUnit\Framework\TestCase; |
|
19
|
|
|
use Sylius\Bundle\CoreBundle\Fixture\ChannelFixture; |
|
20
|
|
|
use Sylius\Bundle\CoreBundle\Fixture\Factory\ExampleFactoryInterface; |
|
21
|
|
|
|
|
22
|
|
|
final class ChannelFixtureTest extends TestCase |
|
23
|
|
|
{ |
|
24
|
|
|
use ConfigurationTestCaseTrait; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* @test |
|
28
|
|
|
*/ |
|
29
|
|
|
public function channels_are_optional(): void |
|
30
|
|
|
{ |
|
31
|
|
|
$this->assertConfigurationIsValid([[]], 'custom'); |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* @test |
|
36
|
|
|
*/ |
|
37
|
|
|
public function channels_can_be_generated_randomly(): void |
|
38
|
|
|
{ |
|
39
|
|
|
$this->assertConfigurationIsValid([['random' => 4]], 'random'); |
|
40
|
|
|
$this->assertPartialConfigurationIsInvalid([['random' => -1]], 'random'); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @test |
|
45
|
|
|
*/ |
|
46
|
|
|
public function channel_code_is_optional(): void |
|
47
|
|
|
{ |
|
48
|
|
|
$this->assertConfigurationIsValid([['custom' => [['code' => 'CUSTOM']]]], 'custom.*.code'); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* @test |
|
53
|
|
|
*/ |
|
54
|
|
|
public function channel_hostname_is_optional(): void |
|
55
|
|
|
{ |
|
56
|
|
|
$this->assertConfigurationIsValid([['custom' => [['hostname' => 'custom.localhost']]]], 'custom.*.hostname'); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* @test |
|
61
|
|
|
*/ |
|
62
|
|
|
public function channel_color_is_optional(): void |
|
63
|
|
|
{ |
|
64
|
|
|
$this->assertConfigurationIsValid([['custom' => [['color' => 'pink']]]], 'custom.*.color'); |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* @test |
|
69
|
|
|
*/ |
|
70
|
|
|
public function channel_may_be_toggled(): void |
|
71
|
|
|
{ |
|
72
|
|
|
$this->assertConfigurationIsValid([['custom' => [['enabled' => false]]]], 'custom.*.enabled'); |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* @test |
|
77
|
|
|
*/ |
|
78
|
|
|
public function channel_locales_are_optional(): void |
|
79
|
|
|
{ |
|
80
|
|
|
$this->assertConfigurationIsValid([['custom' => [['locales' => ['en_US', 'pl_PL']]]]], 'custom.*.locales'); |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* @test |
|
85
|
|
|
*/ |
|
86
|
|
|
public function channel_currencies_are_optional(): void |
|
87
|
|
|
{ |
|
88
|
|
|
$this->assertConfigurationIsValid([['custom' => [['currencies' => ['USD', 'PLN']]]]], 'custom.*.currencies'); |
|
89
|
|
|
} |
|
90
|
|
|
|
|
91
|
|
|
/** |
|
92
|
|
|
* @test |
|
93
|
|
|
*/ |
|
94
|
|
|
public function channel_contact_email_is_optional(): void |
|
95
|
|
|
{ |
|
96
|
|
|
$this->assertConfigurationIsValid( |
|
97
|
|
|
[['custom' => [['contact_email' => '[email protected]']]]], |
|
98
|
|
|
'custom.*.contact_email' |
|
99
|
|
|
); |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
|
|
/** |
|
103
|
|
|
* {@inheritdoc} |
|
104
|
|
|
*/ |
|
105
|
|
|
protected function getConfiguration(): ChannelFixture |
|
106
|
|
|
{ |
|
107
|
|
|
return new ChannelFixture( |
|
108
|
|
|
$this->getMockBuilder(ObjectManager::class)->getMock(), |
|
109
|
|
|
$this->getMockBuilder(ExampleFactoryInterface::class)->getMock() |
|
110
|
|
|
); |
|
111
|
|
|
} |
|
112
|
|
|
} |
|
113
|
|
|
|