mock_objects.php
protected function createCodeForOverridenMethods($methods)
    {
        $code = '';
        foreach ($methods as $method) {
            if ($this->isConstructorOrDeconstructor($method)) {
                continue;
            }
            $code .= '    ' . $this->reflection->getSignature($method) . " {\n";
            $code .= "        return \$this->mock->invoke(\"$method\", func_get_args());\n";
            $code .= "    }\n";
        }

        return $code;
    }
protected function createCodeForOverridenMethods($methods)
    {
        $code = '';
        foreach ($methods as $method) {
            if ($this->isConstructorOrDeconstructor($method)) {
                continue;
            }
            $code .= '    ' . $this->reflection->getSignature($method) . " {\n";
            $code .= "        return \$this->mock->invoke(\"$method\", func_get_args());\n";
            $code .= "    }\n";
        }

        return $code;
    }
Creates source code to override a list of methods with mock versions.

@param array $methods Methods to be overridden with mock versions.

@return string Code for overridden chains.