コード例 #1
0
 /**
  *    Generates a version of a class with selected
  *    methods mocked only. Inherits the old class
  *    and chains the mock methods of an aggregated
  *    mock object.
  *    @param string $class            Class to clone.
  *    @param string $mock_class       New class name.
  *    @param array $methods           Methods to be overridden
  *                                    with mock versions.
  *    @static
  *    @access public
  */
 function generatePartial($class, $mock_class, $methods)
 {
     if (!SimpleTestCompatibility::classExists($class)) {
         return false;
     }
     if (SimpleTestCompatibility::classExists($mock_class)) {
         trigger_error("Partial mock class [{$mock_class}] already exists");
         return false;
     }
     return eval(Mock::_extendClassCode($class, $mock_class, $methods));
 }