Completed
Pull Request — 5.0 (#2162)
by Kevin
14:33
created

LinePagePartTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 49
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 2
dl 49
loc 49
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 4 4 1
A tearDown() 3 3 1
A testToString() 4 4 1
A testGetDefaultView() 4 4 1
A testGetDefaultAdminType() 4 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 Kunstmaan\PagePartBundle\Tests\Entity;
4
5
use Kunstmaan\PagePartBundle\Entity\LinePagePart;
6
7
/**
8
 * LinePagePartTest
9
 */
10 View Code Duplication
class LinePagePartTest 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...
11
{
12
    /**
13
     * @var LinePagePart
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 LinePagePart();
24
    }
25
26
    /**
27
     * Tears down the fixture, for example, closes a network connection.
28
     * This method is called after a test is executed.
29
     */
30
    protected function tearDown()
31
    {
32
    }
33
34
    /**
35
     * @covers Kunstmaan\PagePartBundle\Entity\LinePagePart::__toString
36
     */
37
    public function testToString()
38
    {
39
        $this->assertEquals('LinePagePart', $this->object->__toString());
40
    }
41
42
    /**
43
     * @covers Kunstmaan\PagePartBundle\Entity\LinePagePart::getDefaultView
44
     */
45
    public function testGetDefaultView()
46
    {
47
        $this->assertEquals('KunstmaanPagePartBundle:LinePagePart:view.html.twig', $this->object->getDefaultView());
48
    }
49
50
    /**
51
     * @covers Kunstmaan\PagePartBundle\Entity\LinePagePart::getDefaultAdminType
52
     */
53
    public function testGetDefaultAdminType()
54
    {
55
        $this->assertEquals('Kunstmaan\PagePartBundle\Form\LinePagePartAdminType', $this->object->getDefaultAdminType());
56
    }
57
58
}
59