예제 #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 (!class_exists($class)) {
         return false;
     }
     if (class_exists($mock_class)) {
         return false;
     }
     return eval(Mock::_extendClassCode($class, $mock_class, $methods));
 }
예제 #2
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 (! class_exists($class)) {
         return false;
     }
     if (class_exists($mock_class)) {
         trigger_error("Partial mock class [$mock_class] already exists");
         return false;
     }
     return eval(Mock::_extendClassCode($class, $mock_class, $methods));
 }
예제 #3
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));
 }