aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/IntegrityCheck/Helpers
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2016-12-19 15:35:31 +0100
committerLukas Reschke <lukas@statuscode.ch>2016-12-19 15:35:31 +0100
commit3eb3e437c8a0520192ec7c1018d4d1c55e780dc0 (patch)
treef436ecbdddcd9924277f0ecca24a140be289bc78 /tests/lib/IntegrityCheck/Helpers
parente536313451d071aa9693411b3964ef26ce75c904 (diff)
downloadnextcloud-server-3eb3e437c8a0520192ec7c1018d4d1c55e780dc0.tar.gz
nextcloud-server-3eb3e437c8a0520192ec7c1018d4d1c55e780dc0.zip
Add proper tests
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Diffstat (limited to 'tests/lib/IntegrityCheck/Helpers')
-rw-r--r--tests/lib/IntegrityCheck/Helpers/FileAccessHelperTest.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/lib/IntegrityCheck/Helpers/FileAccessHelperTest.php b/tests/lib/IntegrityCheck/Helpers/FileAccessHelperTest.php
index 740b14e61c4..de4aeec78cc 100644
--- a/tests/lib/IntegrityCheck/Helpers/FileAccessHelperTest.php
+++ b/tests/lib/IntegrityCheck/Helpers/FileAccessHelperTest.php
@@ -40,4 +40,29 @@ class FileAccessHelperTest extends TestCase {
$this->fileAccessHelper->file_put_contents($filePath, $data);
$this->assertSame($data, $this->fileAccessHelper->file_get_contents($filePath));
}
+
+ /**
+ * @expectedException \Exception
+ * @expectedExceptionMessage Failed to write into /anabsolutelynotexistingfolder/on/the/system.txt
+ */
+ public function testFile_put_contentsWithException() {
+ $this->fileAccessHelper->file_put_contents('/anabsolutelynotexistingfolder/on/the/system.txt', 'MyFiles');
+ }
+
+ public function testIs_writable() {
+ $this->assertFalse($this->fileAccessHelper->is_writable('/anabsolutelynotexistingfolder/on/the/system.txt'));
+ $this->assertTrue($this->fileAccessHelper->is_writable(\OC::$server->getTempManager()->getTemporaryFile('MyFile')));
+ }
+
+ /**
+ * @expectedException \Exception
+ * @expectedExceptionMessage Directory /anabsolutelynotexistingfolder/on/the/system does not exist.
+ */
+ public function testAssertDirectoryExistsWithException() {
+ $this->fileAccessHelper->assertDirectoryExists('/anabsolutelynotexistingfolder/on/the/system');
+ }
+
+ public function testAssertDirectoryExists() {
+ $this->fileAccessHelper->assertDirectoryExists(\OC::$server->getTempManager()->getTemporaryFolder('/testfolder/'));
+ }
}