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

TestMethodManagerTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 6
dl 0
loc 40
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 5 1
A testManger() 0 7 1
A testValidManagerWhenValid() 0 5 1
A testValidManagerWhenEmptyMethod() 0 8 1
1
<?php
2
3
namespace HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Items;
4
5
use HelloWordPl\SimpleEntityGeneratorBundle\Lib\Items\MethodGetterManager;
6
use HelloWordPl\SimpleEntityGeneratorBundle\Lib\Items\TestMethodManager;
7
use HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Items\BaseManager;
8
9
/**
10
 * TestMethodManager Test
11
 *
12
 * @author Sławomir Kania <[email protected]>
13
 */
14
class TestMethodManagerTest extends BaseManager
15
{
16
17
    /**
18
     * @var TestMethodManager
19
     */
20
    protected $testMethodManager = null;
21
22
    /**
23
     * SET UP
24
     */
25
    public function setUp()
26
    {
27
        parent::setUp();
28
        $this->testMethodManager = $this->preapareClassManager()->getTestClass()->getMethods()->first();
29
    }
30
31
    public function testManger()
32
    {
33
        $this->assertInstanceOf('\HelloWordPl\SimpleEntityGeneratorBundle\Lib\Interfaces\RenderableInterface', $this->testMethodManager);
34
        $this->assertInstanceOf('\HelloWordPl\SimpleEntityGeneratorBundle\Lib\Interfaces\MethodInterface', $this->testMethodManager);
35
        $this->assertInstanceOf('\HelloWordPl\SimpleEntityGeneratorBundle\Lib\Items\TestMethodManager', $this->testMethodManager);
36
        $this->assertEquals('testSetFullName', $this->testMethodManager->getPreparedName());
37
    }
38
39
    public function testValidManagerWhenValid()
40
    {
41
        $errors = $this->getValidator()->validate($this->testMethodManager);
42
        $this->assertEquals(0, $errors->count());
43
    }
44
45
    public function testValidManagerWhenEmptyMethod()
46
    {
47
        $testMethodManager = $this->testMethodManager;
48
        $testMethodManager->setMethod(new MethodGetterManager($this->preapareClassManager()));
49
50
        $errors = $this->getValidator()->validate($testMethodManager);
51
        $this->assertEquals(1, $errors->count());
52
    }
53
}
54