Completed
Push — master ( 3cf278...ee34b4 )
by Sullivan
02:21
created

ConfigBridgeTest::testNonePresetWithRules()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 16
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 16
rs 9.4285
cc 2
eloc 12
nc 2
nop 0
1
<?php
2
3
namespace SLLH\StyleCIBridge\Tests;
4
5
use SLLH\StyleCIBridge\ConfigBridge;
6
7
/**
8
 * @author Sullivan Senechal <[email protected]>
9
 */
10
class ConfigBridgeTest extends \PHPUnit_Framework_TestCase
11
{
12
    public function testDefaultConfig()
13
    {
14
        $config = ConfigBridge::create(__DIR__.'/Fixtures/configs/default');
15
16
        if (method_exists($config, 'getRules')) {
17
            $this->assertArraySubset(array(
18
                'align_double_arrow' => true,
19
                'long_array_syntax' => true,
20
                'linebreak_after_opening_tag' => true,
21
                'ordered_imports' => true,
22
                'psr0' => false,
23
                'unalign_double_arrow' => false,
24
                'unalign_equals' => false,
25
            ), $config->getRules());
26
        } else { // PHP-CS-Fixer 1.x BC
27
            $this->assertArraySubset(array(
28
                'align_double_arrow',
29
                'newline_after_open_tag',
30
                'ordered_use',
31
                'long_array_syntax',
32
                'linebreak_after_opening_tag',
33
                'ordered_imports',
34
                '-psr0',
35
                '-unalign_double_arrow',
36
                '-unalign_equals',
37
            ), $config->getFixers());
38
        }
39
    }
40
41
    public function testNonePreset()
42
    {
43
        $config = ConfigBridge::create(__DIR__.'/Fixtures/configs/none');
44
45
        if (method_exists($config, 'getRules')) {
46
            $this->assertSame(array(), $config->getRules());
47
        } else { // PHP-CS-Fixer 1.x BC
48
            $this->assertArraySubset(array(), $config->getFixers());
49
        }
50
    }
51
52
    public function testNonePresetWithRules()
53
    {
54
        $config = ConfigBridge::create(__DIR__.'/Fixtures/configs/none_with_rules');
55
56
        if (method_exists($config, 'getRules')) {
57
            $this->assertSame(array(
58
                'align_double_arrow' => true,
59
                'ordered_imports' => true,
60
            ), $config->getRules());
61
        } else { // PHP-CS-Fixer 1.x BC
62
            $this->assertArraySubset(array(
63
                'align_double_arrow',
64
                'ordered_use',
65
            ), $config->getFixers());
66
        }
67
    }
68
}
69