|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Items; |
|
4
|
|
|
|
|
5
|
|
|
use HelloWordPl\SimpleEntityGeneratorBundle\Lib\Items\MethodSetterManager; |
|
6
|
|
|
use HelloWordPl\SimpleEntityGeneratorBundle\Tests\Lib\Items\BaseManager; |
|
7
|
|
|
|
|
8
|
|
|
/** |
|
9
|
|
|
* MethodSetterManager Test |
|
10
|
|
|
* |
|
11
|
|
|
* @author Sławomir Kania <[email protected]> |
|
12
|
|
|
*/ |
|
13
|
|
View Code Duplication |
class MethodSetterManagerTest extends BaseManager |
|
|
|
|
|
|
14
|
|
|
{ |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* @var MethodSetterManager |
|
18
|
|
|
*/ |
|
19
|
|
|
protected $methodSetterManager = null; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* SET UP |
|
23
|
|
|
*/ |
|
24
|
|
|
public function setUp() |
|
25
|
|
|
{ |
|
26
|
|
|
parent::setUp(); |
|
27
|
|
|
$this->methodSetterManager = $this->preapareClassManager()->getMethods()->first(); |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
|
|
public function testManger() |
|
31
|
|
|
{ |
|
32
|
|
|
$this->assertInstanceOf('\HelloWordPl\SimpleEntityGeneratorBundle\Lib\Interfaces\RenderableInterface', $this->methodSetterManager); |
|
33
|
|
|
$this->assertInstanceOf('\HelloWordPl\SimpleEntityGeneratorBundle\Lib\Interfaces\MethodInterface', $this->methodSetterManager); |
|
34
|
|
|
$this->assertInstanceOf('\HelloWordPl\SimpleEntityGeneratorBundle\Lib\Interfaces\SetterMethodInterface', $this->methodSetterManager); |
|
35
|
|
|
$this->assertInstanceOf('\HelloWordPl\SimpleEntityGeneratorBundle\Lib\Items\MethodManager', $this->methodSetterManager); |
|
36
|
|
|
$this->assertInstanceOf('\HelloWordPl\SimpleEntityGeneratorBundle\Lib\Items\MethodSetterManager', $this->methodSetterManager); |
|
37
|
|
|
$this->assertEquals('setFullName', $this->methodSetterManager->getPreparedName()); |
|
38
|
|
|
$this->assertFalse($this->methodSetterManager->canAddTypeHinting()); |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
public function testCanAddTypeHinting() |
|
42
|
|
|
{ |
|
43
|
|
|
$this->assertTrue($this->preapareClassManager()->getMethods()->get(7)->canAddTypeHinting()); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
public function testValidManagerWhenValid() |
|
47
|
|
|
{ |
|
48
|
|
|
$errors = $this->getValidator()->validate($this->methodSetterManager); |
|
49
|
|
|
$this->assertEquals(0, $errors->count()); |
|
50
|
|
|
} |
|
51
|
|
|
} |
|
52
|
|
|
|
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.