summaryrefslogtreecommitdiffstats
path: root/apps/files_encryption/tests/stream.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2012-06-15 23:48:39 +0200
committerRobin Appelman <icewind@owncloud.com>2012-06-16 01:31:03 +0200
commit195c37f88a803055c92fd38f33a4eb7a1440e5ab (patch)
tree5080604305c9aa7cb5a395c9dd1c2c0d49d41e1b /apps/files_encryption/tests/stream.php
parent8484e165167050ad19b8f2f083c04ff0d4a60755 (diff)
downloadnextcloud-server-195c37f88a803055c92fd38f33a4eb7a1440e5ab.tar.gz
nextcloud-server-195c37f88a803055c92fd38f33a4eb7a1440e5ab.zip
fix for encryption binary files
Diffstat (limited to 'apps/files_encryption/tests/stream.php')
-rw-r--r--apps/files_encryption/tests/stream.php17
1 files changed, 16 insertions, 1 deletions
diff --git a/apps/files_encryption/tests/stream.php b/apps/files_encryption/tests/stream.php
index b23805d60b0..4ffeb6210a9 100644
--- a/apps/files_encryption/tests/stream.php
+++ b/apps/files_encryption/tests/stream.php
@@ -50,7 +50,22 @@ class Test_CryptStream extends UnitTestCase {
$file=$this->tmpFiles[$id];
}
$stream=fopen($file,$mode);
- OC_CryptStream::$sourceStreams[$id]=array('path'=>'dummy','stream'=>$stream);
+ OC_CryptStream::$sourceStreams[$id]=array('path'=>'dummy'.$id,'stream'=>$stream);
return fopen('crypt://streams/'.$id,$mode);
}
+
+ function testBinary(){
+ $file=__DIR__.'/binary';
+ $source=file_get_contents($file);
+
+ $stream=$this->getStream('test','w');
+ fwrite($stream,$source);
+ fclose($stream);
+
+ $stream=$this->getStream('test','r');
+ $data=stream_get_contents($stream);
+ fclose($stream);
+ $this->assertEqual(strlen($data),strlen($source));
+ $this->assertEqual($source,$data);
+ }
}