Skip to content
Snippets Groups Projects
Commit 4eb9a69b authored by Robin Appelman's avatar Robin Appelman
Browse files

fix test case for filestorage

file storage no longer needs to implement file_put_contents for streams
parent e2721fc9
No related branches found
No related tags found
No related merge requests found
...@@ -81,10 +81,6 @@ abstract class Test_FileStorage extends UnitTestCase { ...@@ -81,10 +81,6 @@ abstract class Test_FileStorage extends UnitTestCase {
$this->instance->file_put_contents('/lorem.txt',$sourceText); $this->instance->file_put_contents('/lorem.txt',$sourceText);
$this->assertEqual($sourceText,$this->instance->file_get_contents('/lorem.txt'),'data returned from file_get_contents is not equal to the source data'); $this->assertEqual($sourceText,$this->instance->file_get_contents('/lorem.txt'),'data returned from file_get_contents is not equal to the source data');
//fill a file with a stream
$this->instance->file_put_contents('/lorem.txt',fopen($sourceFile,'r'));
$this->assertEqual($sourceText,$this->instance->file_get_contents('/lorem.txt'),'data returned from file_get_contents is not equal to the source data');
//empty the file //empty the file
$this->instance->file_put_contents('/lorem.txt',''); $this->instance->file_put_contents('/lorem.txt','');
$this->assertEqual('',$this->instance->file_get_contents('/lorem.txt'),'file not emptied'); $this->assertEqual('',$this->instance->file_get_contents('/lorem.txt'),'file not emptied');
...@@ -98,15 +94,15 @@ abstract class Test_FileStorage extends UnitTestCase { ...@@ -98,15 +94,15 @@ abstract class Test_FileStorage extends UnitTestCase {
$this->assertEqual(false,$this->instance->getMimeType('/non/existing/file')); $this->assertEqual(false,$this->instance->getMimeType('/non/existing/file'));
$textFile=OC::$SERVERROOT.'/tests/data/lorem.txt'; $textFile=OC::$SERVERROOT.'/tests/data/lorem.txt';
$this->instance->file_put_contents('/lorem.txt',fopen($textFile,'r')); $this->instance->file_put_contents('/lorem.txt',file_get_contents($textFile,'r'));
$this->assertEqual('text/plain',$this->instance->getMimeType('/lorem.txt')); $this->assertEqual('text/plain',$this->instance->getMimeType('/lorem.txt'));
$pngFile=OC::$SERVERROOT.'/tests/data/logo-wide.png'; $pngFile=OC::$SERVERROOT.'/tests/data/logo-wide.png';
$this->instance->file_put_contents('/logo-wide.png',fopen($pngFile,'r')); $this->instance->file_put_contents('/logo-wide.png',file_get_contents($pngFile,'r'));
$this->assertEqual('image/png',$this->instance->getMimeType('/logo-wide.png')); $this->assertEqual('image/png',$this->instance->getMimeType('/logo-wide.png'));
$svgFile=OC::$SERVERROOT.'/tests/data/logo-wide.svg'; $svgFile=OC::$SERVERROOT.'/tests/data/logo-wide.svg';
$this->instance->file_put_contents('/logo-wide.svg',fopen($svgFile,'r')); $this->instance->file_put_contents('/logo-wide.svg',file_get_contents($svgFile,'r'));
$this->assertEqual('image/svg+xml',$this->instance->getMimeType('/logo-wide.svg')); $this->assertEqual('image/svg+xml',$this->instance->getMimeType('/logo-wide.svg'));
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment