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
*/
),
);
$this->verifyFiles($check, $results);
-
- $this->verifyFiles($check, $results);
}
function testGetFolderContentsInRoot() {
}
}
}
- $this->assertTrue(empty($results));
+ $this->assertEquals(array(), $results);
}
/**