I am writing a unit test for a function that throws an exception when file_put_contents fails to write to a file. I need to make sure that the exception is thrown when file_put_contents is unsuccessful. Is there a way in php to make a file temporarily unwritable or unreadable?
I tried with chmod but it does not seem to work in Windows (XAMPP).