| @@ 19-35 (lines=17) @@ | ||
| 16 | * @covers MS\PHPMD\Rule\Test\AbstractMethodNumberOf |
|
| 17 | * @covers MS\PHPMD\Rule\Test\AbstractTestRule |
|
| 18 | */ |
|
| 19 | public function testLessAsserts() |
|
| 20 | { |
|
| 21 | $methodNode = $this->getMethodNode( |
|
| 22 | self::CLASS_NAME, |
|
| 23 | 'testBar', |
|
| 24 | ['MethodPostfix' => array_merge( |
|
| 25 | array_fill(0, 3, $this->getNode('assertTrue')), |
|
| 26 | array_fill(0, 5, $this->getNode('if')) |
|
| 27 | )] |
|
| 28 | ); |
|
| 29 | ||
| 30 | $node = \Mockery::mock('PHPMD\Node\ClassNode'); |
|
| 31 | $node->shouldReceive('getImage')->andReturn(self::CLASS_NAME); |
|
| 32 | $node->shouldReceive('getMethods')->andReturn([$methodNode]); |
|
| 33 | ||
| 34 | $this->assertRule($node, 0); |
|
| 35 | } |
|
| 36 | ||
| 37 | /** |
|
| 38 | * @covers MS\PHPMD\Rule\Test\MethodNumberOfAsserts |
|
| @@ 19-35 (lines=17) @@ | ||
| 16 | * @covers MS\PHPMD\Rule\Test\AbstractMethodNumberOf |
|
| 17 | * @covers MS\PHPMD\Rule\Test\AbstractTestRule |
|
| 18 | */ |
|
| 19 | public function testMoreMocks() |
|
| 20 | { |
|
| 21 | $methodNode = $this->getMethodNode( |
|
| 22 | self::CLASS_NAME, |
|
| 23 | 'testBar', |
|
| 24 | ['MethodPostfix' => array_merge( |
|
| 25 | array_fill(0, 3, $this->getNode('mock')), |
|
| 26 | array_fill(0, 1, $this->getNode('getMock')) |
|
| 27 | )] |
|
| 28 | ); |
|
| 29 | ||
| 30 | $node = \Mockery::mock('PHPMD\Node\ClassNode'); |
|
| 31 | $node->shouldReceive('getImage')->andReturn(self::CLASS_NAME); |
|
| 32 | $node->shouldReceive('getMethods')->andReturn([$methodNode]); |
|
| 33 | ||
| 34 | $this->assertRule($node, 1); |
|
| 35 | } |
|
| 36 | ||
| 37 | /** |
|
| 38 | * @return MethodNumberOfMocks |
|