diff options
author | Robin Appelman <icewind@owncloud.com> | 2012-03-02 18:42:04 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2012-03-02 18:42:57 +0100 |
commit | e8afe4f1588ad5697b8ef6627417dfeb4a6c0573 (patch) | |
tree | 594b6aa8ff154866c6371d30963c401cb11625d1 /tests | |
parent | 4daedda35a3a8cffb283e47b37e66f5b0524cbd8 (diff) | |
download | nextcloud-server-e8afe4f1588ad5697b8ef6627417dfeb4a6c0573.tar.gz nextcloud-server-e8afe4f1588ad5697b8ef6627417dfeb4a6c0573.zip |
add search implementation to filestorage common
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/filestorage.php | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/tests/lib/filestorage.php b/tests/lib/filestorage.php index 6296d7abf99..f8d4d9c4395 100644 --- a/tests/lib/filestorage.php +++ b/tests/lib/filestorage.php @@ -156,9 +156,10 @@ abstract class Test_FileStorage extends UnitTestCase { $this->assertTrue($mTime<=$mtimeEnd); $this->assertEqual($cTime,$originalCTime); - $this->instance->touch('/lorem.txt',100); - $mTime=$this->instance->filemtime('/lorem.txt'); - $this->assertEqual($mTime,100); + if($this->instance->touch('/lorem.txt',100)!==false){ + $mTime=$this->instance->filemtime('/lorem.txt'); + $this->assertEqual($mTime,100); + } $mtimeStart=time(); $fh=$this->instance->fopen('/lorem.txt','a'); @@ -171,4 +172,17 @@ abstract class Test_FileStorage extends UnitTestCase { $this->assertTrue($mtimeStart<=$mTime); $this->assertTrue($mTime<=$mtimeEnd); } + + public function testSearch(){ + $textFile=OC::$SERVERROOT.'/tests/data/lorem.txt'; + $this->instance->file_put_contents('/lorem.txt',file_get_contents($textFile,'r')); + $pngFile=OC::$SERVERROOT.'/tests/data/logo-wide.png'; + $this->instance->file_put_contents('/logo-wide.png',file_get_contents($pngFile,'r')); + $svgFile=OC::$SERVERROOT.'/tests/data/logo-wide.svg'; + $this->instance->file_put_contents('/logo-wide.svg',file_get_contents($svgFile,'r')); + $result=$this->instance->search('logo'); + $this->assertEqual(2,count($result)); + $this->assertNotIdentical(false,array_search('/logo-wide.svg',$result)); + $this->assertNotIdentical(false,array_search('/logo-wide.png',$result)); + } } |