phpmock\Mock::define PHP Method

define() public method

In most cases you don't have to call this method. enable() is doing this for you. But if the mock is defined after the first call in the tested class, the tested class doesn't resolve to the mock. This is documented in Bug #68541. You therefore have to define the namespaced function before the first call. Defining the function has no side effects as you still have to enable the mock. If the function was already defined this method does nothing.
See also: enable()
public define ( )
    public function define()
    {
        $fqfn = $this->getFQFN();
        if (function_exists($fqfn)) {
            return;
        }
        $functionGenerator = new MockFunctionGenerator($this);
        $functionGenerator->defineFunction();
    }