public function file_put_contentsExistingNonWritableFile() { vfsStreamWrapper::register(); vfsStreamWrapper::setRoot(new vfsStreamDirectory('root')); vfsStream::newFile('new.txt', 0400)->at(vfsStreamWrapper::getRoot())->withContent('content'); $this->assertFalse(@file_put_contents(vfsStream::url('root/new.txt'), 'This does not work.')); $this->assertEquals('content', file_get_contents(vfsStream::url('root/new.txt'))); }