Issue/10991 Make unit tests pass on windows

Further fixing to get #10991 done

@th3fallen @DeepDiver1975 


## Common Problems

#### `uniqid()` is not unique on Windows:
If you need a random string in your test please extend the `\Test\TestCase` class instead of `\PHPUnit_Framework_TestCase` (Once this PR is merged) and use `$this->getUniqueID()` instead.

#### Unclosed handles cause unlink() to fail:
On Windows php can not delete files which still have an open handle. Be sure to `fclose()` any handles you open, especially before deleting the file or directory.

#### `chmod()` does not work on Windows:
Windows does not have read/write permissions like UNIX. If you set chmod to 000 you can still write to the file/directory on Windows. In case you need to test something like that, Please mark the test as skipped for Windows, by adding the following code, right before the first assertion relying on the chmod change. We can still make all other assertions that happen till the change, so add it as late as possible:
```php
	if (\OC_Util::runningOnWindows()) {
		$this->markTestSkipped('[Windows] chmod() does not work as intended on Windows.');
	}
```
this needs to be moved up a bit