/** * Initializes the getMetric() method of the given function or method node. * * @param PHP_PMD_Node_Function|PHP_PMD_Node_Method $mock Mock instance. * @param string $metric Metric acronym. * @param mixed $value Expected value. * * @return PHP_PMD_Node_Function|PHP_PMD_Node_Method */ 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; }
/** * Initializes the getParameterCount() method of the given callable. * * @param PHP_PMD_Node_Function|PHP_PMD_Node_Method $mock Mocked callable. * @param integer $parameterCount Number of parameters. * * @return PHP_PMD_Node_Function|PHP_PMD_Node_Method */ private function _initFunctionOrMethod($mock, $parameterCount) { $mock->expects($this->once())->method('getParameterCount')->will($this->returnValue($parameterCount)); return $mock; }