Completed
Push — 1.0-docs-typo-fix ( 45773e )
by Kamil
71:59 queued 40:28
created

channel_currencies_are_optional()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
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