diff --git a/apps/files_encryption/tests/crypt.php b/apps/files_encryption/tests/crypt.php
index 6168f69415e2ee285f4a2c6748433c426508529d..3916b0e15e092c8b81dbdf19d7ba70cfd955c6ef 100755
--- a/apps/files_encryption/tests/crypt.php
+++ b/apps/files_encryption/tests/crypt.php
@@ -77,7 +77,7 @@ class Test_Crypt extends \PHPUnit_Framework_TestCase {
 	}
 	
 	function tearDown() {
-
+		\OC_FileProxy::clearProxies();
     }
 
     function testGenerateKey() {
@@ -756,6 +756,79 @@ class Test_Crypt extends \PHPUnit_Framework_TestCase {
 		$view = new \OC\Files\View('/' . $this->userId . '/files');
 		$view->unlink( $filename );
 	}
+
+	function testViewFilePutAndGetContents() {
+
+		$filename = '/tmp-'.time();
+		$view = new \OC\Files\View('/' . $this->userId . '/files');
+
+		// Save short data as encrypted file using stream wrapper
+		$cryptedFile = $view->file_put_contents( $filename, $this->dataShort );
+
+		// Test that data was successfully written
+		$this->assertTrue( is_int( $cryptedFile ) );
+
+		// Get file decrypted contents
+		$decrypt = $view->file_get_contents( $filename );
+
+		$this->assertEquals( $this->dataShort, $decrypt );
+
+		// Save long data as encrypted file using stream wrapper
+		$cryptedFileLong = $view->file_put_contents( $filename, $this->dataLong );
+
+		// Test that data was successfully written
+		$this->assertTrue( is_int( $cryptedFileLong ) );
+
+		// Get file decrypted contents
+		$decryptLong = $view->file_get_contents( $filename );
+
+		$this->assertEquals( $this->dataLong, $decryptLong );
+
+		// tear down
+		$view->unlink( $filename );
+	}
+
+	function testTouchFile() {
+		$filename = '/tmp-'.time();
+		$view = new \OC\Files\View('/' . $this->userId . '/files');
+
+		// Save short data as encrypted file using stream wrapper
+		$cryptedFile = $view->file_put_contents( $filename, $this->dataShort );
+
+		// Test that data was successfully written
+		$this->assertTrue( is_int( $cryptedFile ) );
+
+		$view->touch($filename);
+
+		// Get file decrypted contents
+		$decrypt = $view->file_get_contents( $filename );
+
+		$this->assertEquals( $this->dataShort, $decrypt );
+
+		// tear down
+		$view->unlink( $filename );
+	}
+
+	function testFopenFile() {
+		$filename = '/tmp-'.time();
+		$view = new \OC\Files\View('/' . $this->userId . '/files');
+
+		// Save short data as encrypted file using stream wrapper
+		$cryptedFile = $view->file_put_contents( $filename, $this->dataShort );
+
+		// Test that data was successfully written
+		$this->assertTrue( is_int( $cryptedFile ) );
+
+		$handle = $view->fopen($filename, 'r');
+
+		// Get file decrypted contents
+		$decrypt = fgets($handle);
+
+		$this->assertEquals( $this->dataShort, $decrypt );
+
+		// tear down
+		$view->unlink( $filename );
+	}
 // 	function testEncryption(){
 // 	
 // 		$key=uniqid();
diff --git a/apps/files_encryption/tests/keymanager.php b/apps/files_encryption/tests/keymanager.php
index d3078fdac9f323eb3db27cbf7881c5f9ed5cd189..28452d779caeeb687932e022353657a52ed54cbb 100644
--- a/apps/files_encryption/tests/keymanager.php
+++ b/apps/files_encryption/tests/keymanager.php
@@ -71,7 +71,7 @@ class Test_Keymanager extends \PHPUnit_Framework_TestCase {
 	function tearDown(){
 	
 		\OC_FileProxy::$enabled = true;
-		
+		\OC_FileProxy::clearProxies();
 	}
 
 	function testGetPrivateKey() {
diff --git a/apps/files_encryption/tests/util.php b/apps/files_encryption/tests/util.php
index 1e4e39cc47b9652fef888e97da4809bfdb0e490a..2d637e20531285958ca9229d50f39fb5f75bd42c 100755
--- a/apps/files_encryption/tests/util.php
+++ b/apps/files_encryption/tests/util.php
@@ -80,7 +80,7 @@ class Test_Enc_Util extends \PHPUnit_Framework_TestCase {
 	function tearDown(){
 	
 		m::close();
-	
+		\OC_FileProxy::clearProxies();
 	}
 	
 	/**