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

StatusCommandTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
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 41
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testExecute() 0 11 1
A testSearch() 0 13 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 StatusCommandTest extends TestCase
8
{
9
    public function testExecute()
10
    {
11
        $input = array(
12
            'command'  => 'db:status',
13
            '--format' => 'csv',
14
        );
15
        $this->assertDisplayContains($input, 'Threads_connected');
16
        $this->assertDisplayContains($input, 'Innodb_buffer_pool_wait_free');
17
        $this->assertDisplayContains($input, 'InnoDB Buffer Pool hit');
18
        $this->assertDisplayContains($input, 'Full table scans');
19
    }
20
21
    public function testSearch()
22
    {
23
        $input = array(
24
            'command'  => 'db:status',
25
            '--format' => 'csv',
26
            'search'   => 'Innodb%',
27
        );
28
        $this->assertDisplayContains($input, 'Innodb_buffer_pool_read_ahead_rnd');
29
        $this->assertDisplayContains($input, 'Innodb_buffer_pool_wait_free');
30
        $this->assertDisplayContains($input, 'InnoDB Buffer Pool hit');
31
        $this->assertDisplayContains($input, 'Innodb_dblwr_pages_written');
32
        $this->assertDisplayContains($input, 'Innodb_os_log_written');
33
    }
34
35
    public function testRounding()
36
    {
37
        $this->assertDisplayRegExp(
38
            array(
39
            'command'    => 'db:status',
40
            '--format'   => 'csv',
41
            '--rounding' => '2',
42
            'search'     => '%size%',
43
            ),
44
            '~Innodb_page_size,[0-9\.]+K,~'
45
        );
46
    }
47
}
48