/** * Clones a class' interface and creates a stub version * that can have return values set. * @param string $class Class to clone. * @param string $stub_class New class name. Default is * the old name with "Stub" * prepended. * @param array $methods Additional methods to add beyond * those in th cloned class. Use this * to emulate the dynamic addition of * methods in the cloned class or when * the class hasn't been written yet. * @static * @access public */ function generate($class, $stub_class = false, $methods = false) { if (! class_exists($class)) { return false; } if (! $stub_class) { $stub_class = "Stub" . $class; } if (class_exists($stub_class)) { return false; } return eval(Stub::_createClassCode( $class, $stub_class, $methods ? $methods : array()) . " return true;"); }
/** * Clones a class' interface and creates a stub version * that can have return values set. * @param string $class Class to clone. * @param string $stub_class New class name. Default is * the old name with "Stub" * prepended. * @param array $methods Additional methods to add beyond * those in the cloned class. Use this * to emulate the dynamic addition of * methods in the cloned class or when * the class hasn't been written yet. * @static * @access public */ function generate($class, $stub_class = false, $methods = false) { if (!SimpleTestCompatibility::classExists($class)) { return false; } if (!$stub_class) { $stub_class = "Stub" . $class; } if (SimpleTestCompatibility::classExists($stub_class)) { return false; } return eval(Stub::_createClassCode($class, $stub_class, $methods ? $methods : array()) . " return true;"); }