title: How to unit test file_put_contents() with file read/write permitions
body: <p>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?</p>
  
  <p>I tried with chmod but it does not seem to work in Windows (XAMPP).</p>