Completed
Push — develop ( 7623eb...611a18 )
by Tom
03:37
created

GetCommandTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 77
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
c 0
b 0
f 0
lcom 0
cbo 1
dl 0
loc 77
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A testExecute() 0 74 1
1
<?php
2
3
namespace N98\Magento\Command\Config;
4
5
use N98\Magento\Command\TestCase;
6
7
class GetCommandTest extends TestCase
8
{
9
    public function testExecute()
10
    {
11
        /**
12
         * Add a new entry (to test for it)
13
         */
14
        $this->assertDisplayContains(
15
            array(
16
                'command' => 'config:set',
17
                'path'    => 'n98_magerun/foo/bar',
18
                'value'   => '1234',
19
            ),
20
            'n98_magerun/foo/bar => 1234'
21
        );
22
23
        $this->assertDisplayContains(
24
            array(
25
                'command' => 'config:get',
26
                'path'    => 'n98_magerun/foo/bar',
27
            ),
28
            '| n98_magerun/foo/bar | default | 0        | 1234  |'
29
        );
30
31
        $this->assertDisplayContains(
32
            array(
33
                'command'         => 'config:get',
34
                'path'            => 'n98_magerun/foo/bar',
35
                '--update-script' => true,
36
            ),
37
            "\$installer->setConfigData('n98_magerun/foo/bar', '1234');"
38
        );
39
40
        $this->assertDisplayContains(
41
            array(
42
                'command'          => 'config:get',
43
                'path'             => 'n98_magerun/foo/bar',
44
                '--magerun-script' => true,
45
            ),
46
            "config:set --scope-id=0 --scope=default -- 'n98_magerun/foo/bar' '1234'"
47
        );
48
49
        /**
50
         * Dump CSV
51
         */
52
        $input = array(
53
            'command'  => 'config:get',
54
            'path'     => 'n98_magerun/foo/bar',
55
            '--format' => 'csv',
56
        );
57
        $this->assertDisplayContains($input, 'Path,Scope,Scope-ID,Value');
58
        $this->assertDisplayContains($input, 'n98_magerun/foo/bar,default,0,1234');
59
60
        /**
61
         * Dump XML
62
         */
63
        $input = array(
64
            'command'  => 'config:get',
65
            'path'     => 'n98_magerun/foo/bar',
66
            '--format' => 'xml',
67
        );
68
        $this->assertDisplayContains($input, '<table>');
69
        $this->assertDisplayContains($input, '<Value>1234</Value>');
70
71
        /**
72
         * Dump JSON
73
         */
74
        $this->assertDisplayRegExp(
75
            array(
76
                'command'  => 'config:get',
77
                'path'     => 'n98_magerun/foo/bar',
78
                '--format' => 'json',
79
            ),
80
            '/"Value":\s*"1234"/'
81
        );
82
    }
83
}
84