[Pkg-owncloud-commits] [owncloud] 38/121: add test for search() in shared cache
David Prévot
taffit at moszumanska.debian.org
Thu Aug 21 16:44:30 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository owncloud.
commit 41fe3f26520d7380a56a43431976efad623cb52e
Author: Jörn Friedrich Dreyer <jfd at butonic.de>
Date: Thu Jul 31 12:06:13 2014 +0200
add test for search() in shared cache
---
apps/files_sharing/tests/cache.php | 78 ++++++++++++++++++++++++++++++++++++--
1 file changed, 75 insertions(+), 3 deletions(-)
diff --git a/apps/files_sharing/tests/cache.php b/apps/files_sharing/tests/cache.php
index 8472c7f..1b0fe6f 100644
--- a/apps/files_sharing/tests/cache.php
+++ b/apps/files_sharing/tests/cache.php
@@ -95,6 +95,80 @@ class Test_Files_Sharing_Cache extends Test_Files_Sharing_Base {
parent::tearDown();
}
+ function searchDataProvider() {
+ return array(
+ array('%another%',
+ array(
+ array('name' => 'another too.txt', 'path' => 'subdir/another too.txt'),
+ array('name' => 'another.txt', 'path' => 'subdir/another.txt'),
+ )
+ ),
+ array('%Another%',
+ array(
+ array('name' => 'another too.txt', 'path' => 'subdir/another too.txt'),
+ array('name' => 'another.txt', 'path' => 'subdir/another.txt'),
+ )
+ ),
+ array('%dir%',
+ array(
+ array('name' => 'emptydir', 'path' => 'emptydir'),
+ array('name' => 'subdir', 'path' => 'subdir'),
+ array('name' => 'shareddir', 'path' => ''),
+ )
+ ),
+ array('%Dir%',
+ array(
+ array('name' => 'emptydir', 'path' => 'emptydir'),
+ array('name' => 'subdir', 'path' => 'subdir'),
+ array('name' => 'shareddir', 'path' => ''),
+ )
+ ),
+ array('%txt%',
+ array(
+ array('name' => 'bar.txt', 'path' => 'bar.txt'),
+ array('name' => 'another too.txt', 'path' => 'subdir/another too.txt'),
+ array('name' => 'another.txt', 'path' => 'subdir/another.txt'),
+ )
+ ),
+ array('%Txt%',
+ array(
+ array('name' => 'bar.txt', 'path' => 'bar.txt'),
+ array('name' => 'another too.txt', 'path' => 'subdir/another too.txt'),
+ array('name' => 'another.txt', 'path' => 'subdir/another.txt'),
+ )
+ ),
+ array('%',
+ array(
+ array('name' => 'bar.txt', 'path' => 'bar.txt'),
+ array('name' => 'emptydir', 'path' => 'emptydir'),
+ array('name' => 'subdir', 'path' => 'subdir'),
+ array('name' => 'another too.txt', 'path' => 'subdir/another too.txt'),
+ array('name' => 'another.txt', 'path' => 'subdir/another.txt'),
+ array('name' => 'not a text file.xml', 'path' => 'subdir/not a text file.xml'),
+ array('name' => 'shareddir', 'path' => ''),
+ )
+ ),
+ array('%nonexistant%',
+ array(
+ )
+ ),
+ );
+ }
+
+ /**
+ * we cannot use a dataProvider because that would cause the stray hook detection to remove the hooks
+ * that were added in setUpBeforeClass.
+ */
+ function testSearch() {
+ foreach ($this->searchDataProvider() as $data) {
+ list($pattern, $expectedFiles) = $data;
+
+ $results = $this->sharedStorage->getCache()->search($pattern);
+
+ $this->verifyFiles($expectedFiles, $results);
+ }
+
+ }
/**
* Test searching by mime type
*/
@@ -115,8 +189,6 @@ class Test_Files_Sharing_Cache extends Test_Files_Sharing_Base {
),
);
$this->verifyFiles($check, $results);
-
- $this->verifyFiles($check, $results);
}
function testGetFolderContentsInRoot() {
@@ -245,7 +317,7 @@ class Test_Files_Sharing_Cache extends Test_Files_Sharing_Base {
}
}
}
- $this->assertTrue(empty($results));
+ $this->assertEquals(array(), $results);
}
/**
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list