mock_objects.php
public function generateSubclass($methods)
    {
        if (! $this->reflection->classOrInterfaceExists()) {
            return false;
        }
        $mock_class = "";
        if (!empty($this->namespace)) {
            $mock_class .= $this->namespace . '\\';
        }
        $mock_class .= $this->mock_class;
        $mock_reflection = new SimpleReflection($mock_class);
        if ($mock_reflection->classExistsWithoutAutoload()) {
            return false;
        }
        if ($this->reflection->isInterface() || $this->reflection->hasFinal()) {
            $code = $this->createCodeForClass($methods ? $methods : array());

            return eval("$code return \$code;");
        } else {
            $code = $this->createCodeForSubclass($methods ? $methods : array());

            return eval("$code return \$code;");
        }
    }
public function generateSubclass($methods)
    {
        if (! $this->reflection->classOrInterfaceExists()) {
            return false;
        }
        $mock_class = "";
        if (!empty($this->namespace)) {
            $mock_class .= $this->namespace . '\\';
        }
        $mock_class .= $this->mock_class;
        $mock_reflection = new SimpleReflection($mock_class);
        if ($mock_reflection->classExistsWithoutAutoload()) {
            return false;
        }
        if ($this->reflection->isInterface() || $this->reflection->hasFinal()) {
            $code = $this->createCodeForClass($methods ? $methods : array());

            return eval("$code return \$code;");
        } else {
            $code = $this->createCodeForSubclass($methods ? $methods : array());

            return eval("$code return \$code;");
        }
    }
Subclasses a class and overrides every method with a mock one
that can have return values and expectations set.
Chains to an aggregated SimpleMock.

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