diff options
author | Thomas Mueller <thomas.mueller@tmit.eu> | 2013-02-18 11:39:04 +0100 |
---|---|---|
committer | Thomas Mueller <thomas.mueller@tmit.eu> | 2013-02-18 11:39:04 +0100 |
commit | 2675290325dc6a67f6719febe5ed0a546bd7a32a (patch) | |
tree | 4bb9a7f1b3de7960e98a4a51e76672eca7c62ca3 /tests | |
parent | 4b80466880b4e2daf25e38d621a0ebac608d335d (diff) | |
parent | 3b9796bfcce38e6e4138ffc68f5a2ff6e34492a0 (diff) | |
download | nextcloud-server-2675290325dc6a67f6719febe5ed0a546bd7a32a.tar.gz nextcloud-server-2675290325dc6a67f6719febe5ed0a546bd7a32a.zip |
Merge branch 'master' into master-sqlserver
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/files/storage/mappedlocalwithdotteddatadir.php | 42 | ||||
-rw-r--r-- | tests/lib/files/storage/storage.php | 16 |
2 files changed, 58 insertions, 0 deletions
diff --git a/tests/lib/files/storage/mappedlocalwithdotteddatadir.php b/tests/lib/files/storage/mappedlocalwithdotteddatadir.php new file mode 100644 index 00000000000..d2e5e2e97af --- /dev/null +++ b/tests/lib/files/storage/mappedlocalwithdotteddatadir.php @@ -0,0 +1,42 @@ +<?php +/** +* ownCloud +* +* @author Robin Appelman +* @copyright 2012 Robin Appelman icewind@owncloud.com +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +* License as published by the Free Software Foundation; either +* version 3 of the License, or any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU AFFERO GENERAL PUBLIC LICENSE for more details. +* +* You should have received a copy of the GNU Affero General Public +* License along with this library. If not, see <http://www.gnu.org/licenses/>. +* +*/ + +namespace Test\Files\Storage; + +class MappedLocalWithDottedDataDir extends Storage { + /** + * @var string tmpDir + */ + private $tmpDir; + + public function setUp() { + $this->tmpDir = \OC_Helper::tmpFolder().'dir.123'.DIRECTORY_SEPARATOR; + mkdir($this->tmpDir); + $this->instance=new \OC\Files\Storage\MappedLocal(array('datadir'=>$this->tmpDir)); + } + + public function tearDown() { + \OC_Helper::rmdirr($this->tmpDir); + unset($this->instance); + } +} + diff --git a/tests/lib/files/storage/storage.php b/tests/lib/files/storage/storage.php index c74a16f509f..f78f66d8b8a 100644 --- a/tests/lib/files/storage/storage.php +++ b/tests/lib/files/storage/storage.php @@ -223,6 +223,22 @@ abstract class Storage extends \PHPUnit_Framework_TestCase { $this->assertContains('/logo-wide.png', $result); } + public function testSearchInSubFolder() { + $this->instance->mkdir('sub') + ; + $textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt'; + $this->instance->file_put_contents('/sub/lorem.txt', file_get_contents($textFile, 'r')); + $pngFile = \OC::$SERVERROOT . '/tests/data/logo-wide.png'; + $this->instance->file_put_contents('/sub/logo-wide.png', file_get_contents($pngFile, 'r')); + $svgFile = \OC::$SERVERROOT . '/tests/data/logo-wide.svg'; + $this->instance->file_put_contents('/sub/logo-wide.svg', file_get_contents($svgFile, 'r')); + + $result = $this->instance->search('logo'); + $this->assertEquals(2, count($result)); + $this->assertContains('/sub/logo-wide.svg', $result); + $this->assertContains('/sub/logo-wide.png', $result); + } + public function testFOpen() { $textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt'; |