ArticlesListParametersConverterTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
B parametersProvider() 0 38 1
A testNeedsConversion() 0 10 2
1
<?php
2
3
namespace Stp\SndApi\News\Test\Converter;
4
5
use Stp\SndApi\News\Converter\ArticlesListParametersConverter;
6
7
class ArticlesListParametersConverterTest extends \PHPUnit_Framework_TestCase
8
{
9
    public function parametersProvider()
10
    {
11
        return [
12
            [
13
                [
14
                    'includeSubsections' => true,
15
                    'homeSectionOnly' => 0
16
                ],
17
                [
18
                    'includeSubsections' => 'true',
19
                    'homeSectionOnly' => 'false'
20
                ],
21
                true
22
            ],
23
            [
24
                [
25
                    'includeSubsections' => true,
26
                    'homeSectionOnly' => 1.2
27
                ],
28
                [
29
                    'includeSubsections' => 'true',
30
                    'homeSectionOnly' => 'true'
31
                ],
32
                true
33
            ],
34
            [
35
                [
36
                    'includeSubsections' => true,
37
                    'homeSectionOnly' => 0
38
                ],
39
                [
40
                    'includeSubsections' => 'true',
41
                    'homeSectionOnly' => false
42
                ],
43
                false
44
            ]
45
        ];
46
    }
47
48
    /**
49
     * @dataProvider parametersProvider
50
     */
51
    public function testNeedsConversion($parameters, $output, $expected)
52
    {
53
        $converter = new ArticlesListParametersConverter();
54
55
        if ($expected) {
56
            $this->assertSame($output, $converter->convert($parameters));
57
        } else {
58
            $this->assertNotSame($output, $converter->convert($parameters));
59
        }
60
    }
61
}
62