Test Failed
Push — master ( 99a915...bca16c )
by Vítězslav
07:03
created

EvidenceListTest   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 71
Duplicated Lines 9.86 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

7 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A checkLists() 0 5 1
A testObjectToID() 7 7 1
A testtoString() 0 4 1
A testDraw() 0 4 1
A testGetMyKey() 0 4 1
A tearDown() 0 4 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace Test\FlexiPeeHP;
4
5
use \FlexiPeeHP\EvidenceList;
6
7
/**
8
 * Generated by PHPUnit_SkeletonGenerator on 2017-09-03 at 01:01:15.
9
 */
10
class EvidenceListTest extends FlexiBeeROTest
11
{
12
    /**
13
     * @var EvidenceList
14
     */
15
    protected $object;
16
17
    /**
18
     * Sets up the fixture, for example, opens a network connection.
19
     * This method is called before a test is executed.
20
     */
21
    protected function setUp()
22
    {
23
        $this->object = new EvidenceList();
24
    }
25
26
    /**
27
     * 
28
     */
29
    public function checkLists()
30
    {
31
        $this->assertTrue(count(EvidenceList::$evidences) > 80);
32
        $this->assertTrue($this->object->setEvidence('cenik'));
33
    }
34
35
    /**
36
     * @covers FlexiPeeHP\EvidenceList::objectToID
37
     */
38 View Code Duplication
    public function testObjectToID()
0 ignored issues
show
Duplication introduced by
This method 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...
39
    {
40
        $this->object->setDataValue($this->object->myKeyColumn, 'TEST');
41
        $this->assertEquals('TEST', $this->object->objectToID($this->object));
42
43
        $this->assertEquals('TEST2', $this->object->objectToID('TEST2'));
0 ignored issues
show
Documentation introduced by
'TEST2' is of type string, but the function expects a object|array.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
44
    }
45
46
    /**
47
     * @covers FlexiPeeHP\EvidenceList::__toString
48
     */
49
    public function testtoString()
50
    {
51
        $this->object->__toString();
52
    }
53
54
    /**
55
     * @covers FlexiPeeHP\EvidenceList::draw
56
     */
57
    public function testDraw($whatWant = NULL)
58
    {
59
        $this->object->draw();
60
    }
61
62
    /**
63
     * @covers FlexiPeeHP\EvidenceList::getMyKey
64
     *
65
     * @todo   Implement testGetMyKey().
66
     */
67
    public function testGetMyKey()
68
    {
69
        $this->object->getmyKey();
70
    }
71
72
    /**
73
     * Tears down the fixture, for example, closes a network connection.
74
     * This method is called after a test is executed.
75
     */
76
    protected function tearDown()
77
    {
78
79
    }
80
}
81