|
@@ 40-50 (lines=11) @@
|
| 37 |
|
* @covers MS\PHPMD\Rule\Symfony2\EntitySimpleGetterSetter |
| 38 |
|
* @covers MS\PHPMD\Rule\Symfony2\AbstractEntityRule |
| 39 |
|
*/ |
| 40 |
|
public function testValidEntity() |
| 41 |
|
{ |
| 42 |
|
$methodNode = $this->getMethodNode(self::CLASS_NAME, 'getData', [ |
| 43 |
|
'ScopeStatement' => [], |
| 44 |
|
'ReturnStatement' => array_fill(0, 1, $this->getNode('return')), |
| 45 |
|
'Variable' => array_fill(0, 1, $this->getNode('$this')), |
| 46 |
|
]); |
| 47 |
|
$classNode = $this->getClassNode([$methodNode]); |
| 48 |
|
|
| 49 |
|
$this->assertRule($classNode, 0); |
| 50 |
|
} |
| 51 |
|
|
| 52 |
|
/** |
| 53 |
|
* @covers MS\PHPMD\Rule\Symfony2\EntitySimpleGetterSetter |
|
@@ 94-104 (lines=11) @@
|
| 91 |
|
* @covers MS\PHPMD\Rule\Symfony2\EntitySimpleGetterSetter |
| 92 |
|
* @covers MS\PHPMD\Rule\Symfony2\AbstractEntityRule |
| 93 |
|
*/ |
| 94 |
|
public function testMultipleReturns() |
| 95 |
|
{ |
| 96 |
|
$methodNode = $this->getMethodNode(self::CLASS_NAME, 'getData', [ |
| 97 |
|
'ScopeStatement' => [], |
| 98 |
|
'ReturnStatement' => array_fill(0, 2, $this->getNode('return')), |
| 99 |
|
'Variable' => array_fill(0, 1, $this->getNode('$this')), |
| 100 |
|
]); |
| 101 |
|
$classNode = $this->getClassNode([$methodNode]); |
| 102 |
|
|
| 103 |
|
$this->assertRule($classNode, 1); |
| 104 |
|
} |
| 105 |
|
|
| 106 |
|
/** |
| 107 |
|
* @covers MS\PHPMD\Rule\Symfony2\EntitySimpleGetterSetter |