expectException(\Icinga\Exception\NotWritableError::class); $file = new File('/dev/null'); $file->fwrite('test'); } public function testWhetherTruncatingNonWritableFilesThrowsAnException() { $this->expectException(\Icinga\Exception\NotWritableError::class); $file = new File('/dev/null'); $file->ftruncate(0); } }