Completed
Push — loose-datetime-comparison-beha... ( 53d44c )
by Kamil
55:05 queued 32:14
created

ConfigurationTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 65
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 3
dl 0
loc 65
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A it_does_not_break_if_not_customized() 0 8 1
A it_has_default_authorization_checker() 0 10 1
A its_authorization_checker_can_be_customized() 0 10 1
A its_authorization_checker_cannot_be_empty() 0 9 1
A getConfiguration() 0 4 1
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
namespace Sylius\Bundle\ResourceBundle\Tests;
13
14
use Matthias\SymfonyConfigTest\PhpUnit\ConfigurationTestCaseTrait;
15
use Sylius\Bundle\ResourceBundle\DependencyInjection\Configuration;
16
17
/**
18
 * @author Anna Walasek <[email protected]>
19
 * @author Kamil Kokot <[email protected]>
20
 */
21
class ConfigurationTest extends \PHPUnit_Framework_TestCase
22
{
23
    use ConfigurationTestCaseTrait;
24
25
    /**
26
     * @test
27
     */
28
    public function it_does_not_break_if_not_customized()
29
    {
30
        $this->assertConfigurationIsValid(
31
            [
32
                []
33
            ]
34
        );
35
    }
36
37
    /**
38
     * @test
39
     */
40
    public function it_has_default_authorization_checker()
41
    {
42
        $this->assertProcessedConfigurationEquals(
43
            [
44
                []
45
            ],
46
            ['authorization_checker' => 'sylius.resource_controller.authorization_checker.disabled'],
47
            'authorization_checker'
48
        );
49
    }
50
51
    /**
52
     * @test
53
     */
54
    public function its_authorization_checker_can_be_customized()
55
    {
56
        $this->assertProcessedConfigurationEquals(
57
            [
58
                ['authorization_checker' => 'custom_service']
59
            ],
60
            ['authorization_checker' => 'custom_service'],
61
            'authorization_checker'
62
        );
63
    }
64
65
    /**
66
     * @test
67
     */
68
    public function its_authorization_checker_cannot_be_empty()
69
    {
70
        $this->assertPartialConfigurationIsInvalid(
71
            [
72
                ['authorization_checker' => '']
73
            ],
74
            'authorization_checker'
75
        );
76
    }
77
78
    /**
79
     * {@inheritdoc}
80
     */
81
    protected function getConfiguration()
82
    {
83
        return new Configuration();
84
    }
85
}
86