| @@ 18-25 (lines=8) @@ | ||
| 15 | /** |
|
| 16 | * @covers MS\PHPMD\Rule\Symfony2\ConstructorNewOperator |
|
| 17 | */ |
|
| 18 | public function testConstructorWithNewOperator() |
|
| 19 | { |
|
| 20 | $node = $this->getMethodNode('TestService', '__construct', [ |
|
| 21 | 'ClassReference' => array_fill(0, 1, $this->getNode('Reader')) |
|
| 22 | ]); |
|
| 23 | ||
| 24 | $this->assertRule($node, 1); |
|
| 25 | } |
|
| 26 | ||
| 27 | /** |
|
| 28 | * @covers MS\PHPMD\Rule\Symfony2\ConstructorNewOperator |
|
| @@ 30-37 (lines=8) @@ | ||
| 27 | /** |
|
| 28 | * @covers MS\PHPMD\Rule\Symfony2\ConstructorNewOperator |
|
| 29 | */ |
|
| 30 | public function testConstructorWithNewAllowedClassName() |
|
| 31 | { |
|
| 32 | $node = $this->getMethodNode('TestService', '__construct', [ |
|
| 33 | 'ClassReference' => array_fill(0, 1, $this->getNode('\DateTime')) |
|
| 34 | ]); |
|
| 35 | ||
| 36 | $this->assertRule($node, 0); |
|
| 37 | } |
|
| 38 | ||
| 39 | /** |
|
| 40 | * @covers MS\PHPMD\Rule\Symfony2\ConstructorNewOperator |
|
| @@ 54-61 (lines=8) @@ | ||
| 51 | /** |
|
| 52 | * @covers MS\PHPMD\Rule\Symfony2\ConstructorNewOperator |
|
| 53 | */ |
|
| 54 | public function testMethodWithNewOperator() |
|
| 55 | { |
|
| 56 | $node = $this->getMethodNode('TestService', 'doThings', [ |
|
| 57 | 'ClassReference' => array_fill(0, 1, $this->getNode('Reader')) |
|
| 58 | ]); |
|
| 59 | ||
| 60 | $this->assertRule($node, 0); |
|
| 61 | } |
|
| 62 | ||
| 63 | /** |
|
| 64 | * @covers MS\PHPMD\Rule\Symfony2\ConstructorNewOperator |
|
| @@ 66-73 (lines=8) @@ | ||
| 63 | /** |
|
| 64 | * @covers MS\PHPMD\Rule\Symfony2\ConstructorNewOperator |
|
| 65 | */ |
|
| 66 | public function testMethodWithNamespaceNewOperator() |
|
| 67 | { |
|
| 68 | $node = $this->getMethodNode('TestService', 'doThings', [ |
|
| 69 | 'ClassReference' => array_fill(0, 1, $this->getNode('Doctrine\ArrayCollection')) |
|
| 70 | ]); |
|
| 71 | ||
| 72 | $this->assertRule($node, 0); |
|
| 73 | } |
|
| 74 | ||
| 75 | /** |
|
| 76 | * @return ConstructorNewOperator |
|