In my unit test, i'm looking to stub the behaviour of php's inbuilt file_get_contents() method.
Is there a way to stub native methods in PHP (such as file_get_contents() or print_r()) and the likes?
If by "stub" you mean replace, there is a PHP override_function function; it's part of PECL though. You can also rename them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With