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

VariablesCommandTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testExecute() 0 12 1
A testSearch() 0 14 1
A testRounding() 0 12 1
1
<?php
2
3
namespace N98\Magento\Command\Database;
4
5
use N98\Magento\Command\TestCase;
6
7
class VariablesCommandTest extends TestCase
8
{
9
    public function testExecute()
10
    {
11
        $input = array(
12
            'command'  => 'db:variables',
13
            '--format' => 'csv',
14
        );
15
16
        $this->assertDisplayContains($input, 'have_query_cache');
17
        $this->assertDisplayContains($input, 'innodb_log_buffer_size');
18
        $this->assertDisplayContains($input, 'max_connections');
19
        $this->assertDisplayContains($input, 'thread_cache_size');
20
    }
21
22
    public function testSearch()
23
    {
24
        $input = array(
25
            'command'  => 'db:variables',
26
            '--format' => 'csv',
27
            'search'   => 'Innodb%',
28
        );
29
30
        $this->assertDisplayContains($input, 'innodb_concurrency_tickets');
31
        $this->assertDisplayContains($input, 'innodb_file_format_check');
32
        $this->assertDisplayContains($input, 'innodb_force_load_corrupted');
33
        $this->assertDisplayContains($input, 'innodb_log_file_size');
34
        $this->assertDisplayContains($input, 'innodb_read_io_threads');
35
    }
36
37
    public function testRounding()
38
    {
39
        $input = array(
40
            'command'    => 'db:variables',
41
            '--format'   => 'csv',
42
            '--rounding' => '2',
43
            'search'     => '%size%',
44
        );
45
46
        $this->assertDisplayRegExp($input, '~max_binlog_stmt_cache_size," [0-9\.]+[A-Z]"~');
47
        $this->assertDisplayRegExp($input, '~myisam_max_sort_file_size," +[0-9\.]+[A-Z]"~');
48
    }
49
}
50