ProgressWriterSpec::let()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 2
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace spec\Port\SymfonyConsole;
4
5
use Port\Reader\CountableReader;
6
use Symfony\Component\Console\Formatter\OutputFormatterInterface;
7
use Symfony\Component\Console\Output\OutputInterface;
8
use PhpSpec\ObjectBehavior;
9
use Prophecy\Argument;
10
11
class ProgressWriterSpec extends ObjectBehavior
12
{
13
    function let(OutputInterface $output, CountableReader $reader)
14
    {
15
        $this->beConstructedWith($output, $reader);
16
    }
17
18
    function it_is_initializable()
19
    {
20
        $this->shouldHaveType('Port\SymfonyConsole\ProgressWriter');
21
    }
22
23
    function it_writes_items(CountableReader $reader, OutputInterface $output, OutputFormatterInterface $outputFormatter)
24
    {
25
        $reader->count()->willReturn(2);
26
        $output->isDecorated()->willReturn(true);
27
        $output->getFormatter()->willReturn($outputFormatter);
28
        $output->getVerbosity()->willReturn('debug');
29
        $output->write(Argument::type('string'))->shouldBeCalled();
30
31
        $this->prepare();
32
33
        $this->writeItem([
34
            'first'  => 'The first',
35
            'second' => 'Second property',
36
        ]);
37
38
        $this->writeItem([
39
            'first'  => 'Another first',
40
            'second' => 'Last second',
41
        ]);
42
43
        $this->finish();
44
    }
45
}
46