(This is a PHP-Mock class written by myself, referring to a project on GitHub. The PHP-Mock class can redefine the specified function in the specified namespace, supports system functions and user-defined functions, but does not support public namespaces. Example of how to use:
require 'phpmock.php';
use phpmock\Mock;
// The following is to let the file_get_contents function under the app\controller\home namespace return "123456"
$func = function($url){
return '123456';
}
Mock::builder('\\app\\controller\\home', 'file_get_contents', $func);)