ArticlesListParametersValidatorTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 87
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 87
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A parametersProvider() 0 75 1
A testValidator() 0 5 1
1
<?php
2
3
namespace Stp\SndApi\News\Test\Validator;
4
5
use Stp\SndApi\News\Validator\ArticlesListParametersValidator;
6
7
class ArticlesListParametersValidatorTest extends \PHPUnit_Framework_TestCase
8
{
9
    public function parametersProvider()
10
    {
11
        return [
12
            [
13
                'desked',
14
                [
15
                    'areaLimit' => 1
16
                ],
17
                true
18
            ],
19
            [
20
                'desked',
21
                [
22
                    'invalid' => 'true'
23
                ],
24
                false
25
            ],
26
            [
27
                'auto',
28
                [
29
                    'offset' => 20,
30
                    'limit' => 20
31
                ],
32
                true
33
            ],
34
            [
35
                'auto',
36
                [
37
                    'offset' => 20,
38
                    'limit' => 20,
39
                    'invalid' => 'true'
40
                ],
41
                false
42
            ],
43
            [
44
                'auto',
45
                [
46
                    'offset' => 20,
47
                    'limit' => 20,
48
                    'includeSubsections' => 'true'
49
                ],
50
                true
51
            ],
52
            [
53
                'auto',
54
                [
55
                    'offset' => 20,
56
                    'limit' => 20,
57
                    'includeSubsections' => 'true',
58
                    'homeSectionOnly' => 'true'
59
                ],
60
                true
61
            ],
62
            [
63
                'auto',
64
                [
65
                    'offset' => 20,
66
                    'limit' => 20,
67
                    'includeSubsections' => 'true',
68
                    'invalid' => 'true'
69
                ],
70
                false
71
            ],
72
            [
73
                'auto',
74
                [
75
                    'offset' => 20,
76
                    'limit' => 20,
77
                    'invalid' => 'true',
78
                    'homeSectionOnly' => 'true'
79
                ],
80
                false
81
            ]
82
        ];
83
    }
84
85
    /**
86
     * @dataProvider parametersProvider
87
     */
88
    public function testValidator($method, $parameters, $expected)
89
    {
90
        $validator = new ArticlesListParametersValidator($method, $parameters);
91
        $this->assertEquals($expected, $validator->isValid());
92
    }
93
}
94