Completed
Push — master ( 5d5235...483143 )
by Guillaume
04:19
created

ListRendererTest::testListRenderer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 8

Duplication

Lines 13
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 13
loc 13
rs 9.4285
cc 1
eloc 8
nc 1
nop 0
1
<?php
2
3
namespace Hogosha\Monitor\Renderer;
4
5
use Hogosha\Monitor\Model\Result;
6
use Hogosha\Monitor\Model\ResultCollection;
7
use Webmozart\Console\Api\IO\IO;
8
use Webmozart\Console\IO\BufferedIO;
9
10
/**
11
 * @author Guillaume Cavana <[email protected]>
12
 */
13 View Code Duplication
class ListRendererTest extends \PHPUnit_Framework_TestCase
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
14
{
15
    /**
16
     * @var BufferedIO
17
     */
18
    private $io;
19
20
    protected function setUp()
21
    {
22
        $this->io = new BufferedIO();
23
    }
24
25
    /**
26
     * testTableRenderer.
27
     */
28
    public function testListRenderer()
29
    {
30
        $renderer = RendererFactory::create('list', $this->io);
31
        $renderer->render($this->createResultCollection());
32
33
        $output = <<<TABLE
34
[FAIL][200] Example - 0.42
35
36
TABLE;
37
38
        $this->assertInstanceOf(RendererInterface::class, $renderer);
39
        $this->assertSame($output, $this->io->fetchOutput());
40
    }
41
42
    /**
43
     * createResultCollection.
44
     */
45
    public function createResultCollection()
46
    {
47
        $result = new Result('Example', 200, 0.42, 404);
48
49
        $resultCollection = new ResultCollection();
50
        $resultCollection->append($result);
51
52
        return $resultCollection;
53
    }
54
}
55