Completed
Push — master ( 8ec94e...9abf36 )
by Nils
02:18
created

CliReporter::renderSkipped()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace whm\Smoke\Extensions\SmokeReporter\Reporter;
4
5
use Symfony\Component\Console\Output\OutputInterface;
6
use whm\Smoke\Extensions\SmokeResponseRetriever\Retriever\Retriever;
7
use whm\Smoke\Rules\CheckResult;
8
9
abstract class CliReporter implements Reporter
10
{
11
    /**
12
     * @var OutputInterface
13
     */
14
    protected $output;
15
16
    /**
17
     * @var Retriever
18
     */
19
    protected $retriever;
20
21
    public function setResponseRetriever(Retriever $retriever)
22
    {
23
        $this->retriever = $retriever;
24
    }
25
26
    protected function setOutputInterface(OutputInterface $output)
27
    {
28
        $this->output = $output;
29
    }
30
31
    protected function renderFailure(CheckResult $result)
32
    {
33
        $this->output->writeln('   <error> ' . (string) $result->getResponse()->getUri() . ' </error> coming from ' . (string) $this->retriever->getComingFrom($result->getResponse()->getUri()));
34
        $this->output->writeln('    - ' . $result->getMessage() . ' [rule: ' . $result->getRuleName() . ']');
35
        $this->output->writeln('');
36
    }
37
38
    protected function renderSuccess(CheckResult $result)
39
    {
40
        $this->output->writeln('   <info> ' . (string) $result->getResponse()->getUri() . ' </info> all tests passed');
41
    }
42
43
    protected function renderSkipped(CheckResult $result)
44
    {
45
        $this->output->writeln('   <comment> ' . (string) $result->getResponse()->getUri() . ' </comment>test skipped');
46
        $this->output->writeln('    - ' . $result->getMessage() . ' [rule: ' . $result->getRuleName() . ']');
47
    }
48
}
49