Code Duplication    Length = 37-37 lines in 2 locations

src/HelloWordPl/SimpleEntityGeneratorBundle/Tests/Lib/Items/ClassConstructorManagerTest.php 1 location

@@ 14-50 (lines=37) @@
11
 *
12
 * @author SÅ‚awomir Kania <[email protected]>
13
 */
14
class ClassConstructorManagerTest extends BaseManager
15
{
16
17
    /**
18
     * @var ClassConstructorManager
19
     */
20
    protected $constructorManager = null;
21
22
    /**
23
     * SET UP
24
     */
25
    public function setUp()
26
    {
27
        parent::setUp();
28
        $this->constructorManager = $this->preapareClassManager()->getConstructor();
29
    }
30
31
    public function testManger()
32
    {
33
        $this->assertInstanceOf('\HelloWordPl\SimpleEntityGeneratorBundle\Lib\Interfaces\RenderableInterface', $this->constructorManager);
34
        $this->assertInstanceOf('\HelloWordPl\SimpleEntityGeneratorBundle\Lib\Items\ClassConstructorManager', $this->constructorManager);
35
    }
36
37
    public function testValidManagerWhenValid()
38
    {
39
        $errors = $this->getValidator()->validate($this->constructorManager);
40
        $this->assertEquals(0, $errors->count());
41
    }
42
43
    public function testValidManagerWhenInValidClassManager()
44
    {
45
        $emptyClassManager = new ClassManager();
46
        $this->constructorManager->setClassManager($emptyClassManager);
47
        $errors = $this->getValidator()->validate($this->constructorManager);
48
        $this->assertEquals(3, $errors->count());
49
    }
50
}
51

src/HelloWordPl/SimpleEntityGeneratorBundle/Tests/Lib/Items/InitPropertyManagerTest.php 1 location

@@ 14-50 (lines=37) @@
11
 *
12
 * @author SÅ‚awomir Kania <[email protected]>
13
 */
14
class InitPropertyManagerTest extends BaseManager
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