Moved function name into module scope.
Added the general creation of the $object needed to mock the function.