mirror of
https://codeberg.org/icewind/SearchDAV.git
synced 2026-06-03 09:34:08 +02:00
fmt
This commit is contained in:
parent
3d85afde98
commit
4d51484de3
22 changed files with 103 additions and 72 deletions
|
|
@ -54,6 +54,5 @@ class DummyBackend implements ISearchBackend {
|
|||
}
|
||||
|
||||
public function preloadPropertyFor(array $nodes, array $requestProperties): void {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ use Sabre\DAV\Server;
|
|||
use SearchDAV\DAV\PathHelper;
|
||||
|
||||
class PathHelperTest extends TestCase {
|
||||
public function uriProvider(){
|
||||
public function uriProvider() {
|
||||
return [
|
||||
['/', '', ''],
|
||||
['/index.php/', 'foo', 'foo'],
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ use SearchDAV\XML\Order;
|
|||
use SearchDAV\XML\Scope;
|
||||
use SearchDAV\XML\SupportedQueryGrammar;
|
||||
|
||||
|
||||
class QueryParserTest extends TestCase {
|
||||
public function testParseBasicQuery() {
|
||||
$query = file_get_contents(__DIR__ . '/basicquery.xml');
|
||||
|
|
|
|||
|
|
@ -180,12 +180,22 @@ class SearchPluginTest extends TestCase {
|
|||
$this->searchBackend->expects($this->once())
|
||||
->method('getPropertyDefinitionsForScope')
|
||||
->willReturn([
|
||||
new SearchPropertyDefinition('{DAV:}getcontentlength', true, true, true,
|
||||
SearchPropertyDefinition::DATATYPE_NONNEGATIVE_INTEGER),
|
||||
new SearchPropertyDefinition(
|
||||
'{DAV:}getcontentlength',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
SearchPropertyDefinition::DATATYPE_NONNEGATIVE_INTEGER
|
||||
),
|
||||
new SearchPropertyDefinition('{DAV:}getcontenttype', true, true, true),
|
||||
new SearchPropertyDefinition('{DAV:}displayname', true, true, true),
|
||||
new SearchPropertyDefinition('{http://ns.nextcloud.com:}fileid', false, true, true,
|
||||
SearchPropertyDefinition::DATATYPE_NONNEGATIVE_INTEGER),
|
||||
new SearchPropertyDefinition(
|
||||
'{http://ns.nextcloud.com:}fileid',
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
SearchPropertyDefinition::DATATYPE_NONNEGATIVE_INTEGER
|
||||
),
|
||||
]);
|
||||
|
||||
$plugin->searchHandler($request, $response);
|
||||
|
|
@ -274,8 +284,13 @@ class SearchPluginTest extends TestCase {
|
|||
->method('isValidScope')
|
||||
->willReturn(true);
|
||||
|
||||
$lengthProp = new SearchPropertyDefinition('{DAV:}getcontentlength', true, true, true,
|
||||
SearchPropertyDefinition::DATATYPE_NONNEGATIVE_INTEGER);
|
||||
$lengthProp = new SearchPropertyDefinition(
|
||||
'{DAV:}getcontentlength',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
SearchPropertyDefinition::DATATYPE_NONNEGATIVE_INTEGER
|
||||
);
|
||||
$orderBy = [
|
||||
new \SearchDAV\Query\Order($lengthProp, \SearchDAV\Query\Order::ASC),
|
||||
];
|
||||
|
|
@ -347,8 +362,13 @@ class SearchPluginTest extends TestCase {
|
|||
->method('getArbiterPath')
|
||||
->willReturn('foo');
|
||||
|
||||
$lengthProp = new SearchPropertyDefinition('{DAV:}getcontentlength', true, true, true,
|
||||
SearchPropertyDefinition::DATATYPE_NONNEGATIVE_INTEGER);
|
||||
$lengthProp = new SearchPropertyDefinition(
|
||||
'{DAV:}getcontentlength',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
SearchPropertyDefinition::DATATYPE_NONNEGATIVE_INTEGER
|
||||
);
|
||||
$plugin = new SearchPlugin($this->searchBackend);
|
||||
$server = new Server();
|
||||
$plugin->initialize($server);
|
||||
|
|
@ -483,8 +503,13 @@ class SearchPluginTest extends TestCase {
|
|||
$this->searchBackend->expects($this->once())
|
||||
->method('getPropertyDefinitionsForScope')
|
||||
->willReturn([
|
||||
new SearchPropertyDefinition('{http://ns.nextcloud.com:}fileid', false, true, true,
|
||||
SearchPropertyDefinition::DATATYPE_NONNEGATIVE_INTEGER),
|
||||
new SearchPropertyDefinition(
|
||||
'{http://ns.nextcloud.com:}fileid',
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
SearchPropertyDefinition::DATATYPE_NONNEGATIVE_INTEGER
|
||||
),
|
||||
]);
|
||||
|
||||
$plugin->searchHandler($request, $response);
|
||||
|
|
@ -518,10 +543,20 @@ class SearchPluginTest extends TestCase {
|
|||
$this->searchBackend->expects($this->any())
|
||||
->method('getPropertyDefinitionsForScope')
|
||||
->willReturn([
|
||||
new SearchPropertyDefinition('{http://ns.nextcloud.com:}fileid', false, true, true,
|
||||
SearchPropertyDefinition::DATATYPE_NONNEGATIVE_INTEGER),
|
||||
new SearchPropertyDefinition('{DAV:}getcontentlength', true, true, true,
|
||||
SearchPropertyDefinition::DATATYPE_NONNEGATIVE_INTEGER),
|
||||
new SearchPropertyDefinition(
|
||||
'{http://ns.nextcloud.com:}fileid',
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
SearchPropertyDefinition::DATATYPE_NONNEGATIVE_INTEGER
|
||||
),
|
||||
new SearchPropertyDefinition(
|
||||
'{DAV:}getcontentlength',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
SearchPropertyDefinition::DATATYPE_NONNEGATIVE_INTEGER
|
||||
),
|
||||
]);
|
||||
|
||||
$plugin->searchHandler($request, $response);
|
||||
|
|
@ -555,15 +590,24 @@ class SearchPluginTest extends TestCase {
|
|||
$this->searchBackend->expects($this->any())
|
||||
->method('getPropertyDefinitionsForScope')
|
||||
->willReturn([
|
||||
new SearchPropertyDefinition('{http://ns.nextcloud.com:}fileid', false, true, true,
|
||||
SearchPropertyDefinition::DATATYPE_NONNEGATIVE_INTEGER),
|
||||
new SearchPropertyDefinition('{DAV:}getcontentlength', true, true, true,
|
||||
SearchPropertyDefinition::DATATYPE_NONNEGATIVE_INTEGER),
|
||||
new SearchPropertyDefinition(
|
||||
'{http://ns.nextcloud.com:}fileid',
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
SearchPropertyDefinition::DATATYPE_NONNEGATIVE_INTEGER
|
||||
),
|
||||
new SearchPropertyDefinition(
|
||||
'{DAV:}getcontentlength',
|
||||
true,
|
||||
true,
|
||||
true,
|
||||
SearchPropertyDefinition::DATATYPE_NONNEGATIVE_INTEGER
|
||||
),
|
||||
]);
|
||||
|
||||
$plugin->searchHandler($request, $response);
|
||||
|
||||
$this->assertEquals(400, $response->getStatus());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue