Completed
Push — master ( 794f3d...1e9726 )
by diego
07:00
created

CountCommandTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 0
cbo 3
dl 0
loc 23
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A is_instantiable() 0 5 1
A counts_lines_based_on_regex() 0 8 1
1
<?php
2
namespace Diego\Grepper\Tests\Command;
3
4
use Diego\Grepper\Command\CountCommand;
5
6
/**
7
 * Class CountCommandTest
8
 */
9
class CountCommandTest extends BaseCommandTestCase
10
{
11
    /**
12
     * @test
13
     */
14
    public function is_instantiable()
15
    {
16
        $command = new CountCommand;
17
        $this->assertTrue($command instanceof CountCommand);
18
    }
19
20
    /**
21
     * @test
22
     */
23
    public function counts_lines_based_on_regex()
24
    {
25
        $name = 'count';
26
        $tester = $this->setUpCommandTesterFor($name, CountCommand::class);
27
        $tester->execute(['command' => $name, 'input' => 'vfs://root/input.csv', 'expression' => '/^[0-9]{3}$/']);
28
29
        $this->assertRegExp('/Found 2 matches\./', $tester->getDisplay());
30
    }
31
}
32