Пример #1
0
 /**
  * testMagicCallThrowsExceptionWhenNoMatchingMethodExists
  *
  * @return void
  * @expectedException BadMethodCallException
  */
 public function testMagicCallThrowsExceptionWhenNoMatchingMethodExists()
 {
     $node = new FunctionNode(new ASTFunction(null));
     $node->getFooBar();
 }
Пример #2
0
 /**
  * Initializes the getParameterCount() method of the given callable.
  *
  * @param \PHPMD\Node\FunctionNode|\PHPMD\Node\MethodNode $mock
  * @param integer $parameterCount
  * @return \PHPMD\Node\FunctionNode|\PHPMD\Node\MethodNode
  */
 private function initFunctionOrMethodMock($mock, $parameterCount)
 {
     $mock->expects($this->once())->method('getParameterCount')->will($this->returnValue($parameterCount));
     return $mock;
 }
Пример #3
0
 /**
  * Initializes the getMetric() method of the given function or method node.
  *
  * @param \PHPMD\Node\FunctionNode|\PHPMD\Node\MethodNode $mock
  * @param string $metric
  * @param mixed $value
  * @return \PHPMD\Node\FunctionNode|\PHPMD\Node\MethodNode
  */
 protected function initFunctionOrMethod($mock, $metric, $value)
 {
     if ($metric === null) {
         return $mock;
     }
     $mock->expects($this->atLeastOnce())->method('getMetric')->with($this->equalTo($metric))->will($this->returnValue($value));
     return $mock;
 }