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