0

I am writing tests for a php software and i would like to know how can i mock a function (no from a class, but from a file full of functions). This function call to a build-in php function "getallheaders" but how i am using phpunit to reach that function there is no such header in the request so as a consecuence i get "Error: Call to undefined function getallheaders()".

How can i avoid that from phpunit? Remember, there is no namespaces in this software and also this particular function doesn´t belong to a class, belong to a script full of functions.

I will appreciate any help. Thanks

  • https://github.com/tcz/phpunit-mockfunction if you actually have to mock built in functions – Steve Aug 09 '16 at 16:11
  • 1
    http://stackoverflow.com/questions/13224615/get-the-http-headers-from-current-request-in-php if your only issue is `getallheaders` being undefined – Steve Aug 09 '16 at 16:11

0 Answers0