Completed
Branch master (3b8125)
by
unknown
01:32
created

testValidManagerWhenValid()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 5
Ratio 100 %

Importance

Changes 0
Metric Value
dl 5
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Items;
4
5
use HelloWordPl\SimpleEntityGeneratorBundle\Lib\Items\InitPropertyManager;
6
use HelloWordPl\SimpleEntityGeneratorBundle\Lib\Items\PropertyManager;
7
use HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Items\BaseManager;
8
9
/**
10
 * InitPropertyManager Test
11
 *
12
 * @author Sławomir Kania <[email protected]>
13
 */
14 View Code Duplication
class InitPropertyManagerTest extends BaseManager
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...
15
{
16
17
    /**
18
     * @var InitPropertyManager
19
     */
20
    protected $initPropertyManager = null;
21
22
    /**
23
     * SET UP
24
     */
25
    public function setUp()
26
    {
27
        parent::setUp();
28
        $initProperties = $this->preapareClassManager()->getConstructor()->getInitProperties();
29
        $this->initPropertyManager = $initProperties->first();
30
    }
31
32
    public function testManger()
33
    {
34
        $this->assertInstanceOf('\HelloWordPl\SimpleEntityGeneratorBundle\Lib\Interfaces\RenderableInterface', $this->initPropertyManager);
35
        $this->assertInstanceOf('\HelloWordPl\SimpleEntityGeneratorBundle\Lib\Items\InitPropertyManager', $this->initPropertyManager);
36
    }
37
38
    public function testValidManagerWhenValid()
39
    {
40
        $errors = $this->getValidator()->validate($this->initPropertyManager);
41
        $this->assertEquals(0, $errors->count());
42
    }
43
44
    public function testValidManagerWhenEmptyProperty()
45
    {
46
        $this->initPropertyManager->setProperty(new PropertyManager());
47
        $errors = $this->getValidator()->validate($this->initPropertyManager);
48
        $this->assertEquals(4, $errors->count());
49
    }
50
}
51