mock_objects.php
public function invoke($method, $args)
    {
        $method = strtolower($method);
        $step   = $this->getCallCount($method);
        $this->addCall($method, $args);
        $this->checkExpectations($method, $args, $step);
        $was = $this->disableEStrict();
        try {
            $result = $this->emulateCall($method, $args, $step);
        } catch (Exception $e) {
            $this->restoreEStrict($was);
            throw $e;
        }
        $this->restoreEStrict($was);

        return $result;
    }
public function invoke($method, $args)
    {
        $method = strtolower($method);
        $step   = $this->getCallCount($method);
        $this->addCall($method, $args);
        $this->checkExpectations($method, $args, $step);
        $was = $this->disableEStrict();
        try {
            $result = $this->emulateCall($method, $args, $step);
        } catch (Exception $e) {
            $this->restoreEStrict($was);
            throw $e;
        }
        $this->restoreEStrict($was);

        return $result;
    }
Returns the expected value for the method name and checks expectations.
Will generate anytest assertions as a result of expectations
if there is a test present.

@param string $method Name of method to simulate.
@param array  $args   Arguments as an array.

@return mixed Stored return.