Ejemplo n.º 1
0
 /**
  * This method is a mirror of PHPUnit's $this->getMock(), except the
  * $methods array is a list of methods you do NOT want to mock.
  * It is useful if you want to just test a single method in your
  * class and it should call methods X, Y, and Z, but not anything else.
  * 
  * @param string $className Class to mock
  * @param array $methodsToKeep Methods you don't want to mock
  * @param array $arguments Arguments to pass to the constructor
  * @param string $mockClassName Desired mocked class or empty string
  * @param boolean $callConstructor If true, call original constructor
  * @param boolean $callOriginalClone If true, call original clone method
  * @param boolean $callAutoload If true, use autoload for original class
  * @return PHPUnit_Framework_MockObject_MockObject  The mock object.
  * @throws PHPUnit_Framework_Exception
  * @throws InvalidArgumentException
  */
 public function getMockExceptMethods($className, $methodsToKeep = array())
 {
     // get the arguments to pass to getMock
     $args = func_get_args();
     // set the list of methods to be mocked
     $args[1] = PHPToolsTestUtil::getMockExceptMethodsHelper($className, $methodsToKeep);
     // return the mock
     return call_user_func_array(array($this, 'getMock'), $args);
 }