I am using prophesize method to mock Class
Example:
$user = $this->prophesize(User::class);
How to mock PHP built-in method?
exactly I need to mock locale_accept_from_http($language);
Do you have idea how to handle this?
I am using prophesize method to mock Class
Example:
$user = $this->prophesize(User::class);
How to mock PHP built-in method?
exactly I need to mock locale_accept_from_http($language);
Do you have idea how to handle this?
Copyright © 2021 Jogjafile Inc.
You don't mock PHPs native method, but instead write a wrapper for everything you need.
And now you can mock that with:
Any if your are interested in the way Symfony proposes to handle the users locale from the header, check out this EventListener in their demo app: https://github.com/symfony/demo/blob/master/src/EventSubscriber/RedirectToPreferredLocaleSubscriber.php