mock_objects.php
public function generate($methods)
    {
        if (! $this->reflection->classOrInterfaceExists()) {
            return false;
        }
        $mock_reflection = new SimpleReflection($this->mock_class);
        if ($mock_reflection->classExistsWithoutAutoload()) {
            return false;
        }
        $code = $this->createCodeForClass($methods ? $methods : array());

        return eval("$code return \$code;");
    }
public function generate($methods)
    {
        if (! $this->reflection->classOrInterfaceExists()) {
            return false;
        }
        $mock_reflection = new SimpleReflection($this->mock_class);
        if ($mock_reflection->classExistsWithoutAutoload()) {
            return false;
        }
        $code = $this->createCodeForClass($methods ? $methods : array());

        return eval("$code return \$code;");
    }
Clones a class' interface and creates a mock version that can have return values and expectations set.

@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.