mirror of
https://codeberg.org/icewind/SearchDAV.git
synced 2026-06-03 17:44:06 +02:00
fix test
This commit is contained in:
parent
2f87fb84d3
commit
7174c02348
2 changed files with 77 additions and 58 deletions
|
|
@ -84,7 +84,8 @@ class SearchHandler {
|
|||
$response->setBody($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
$data = $this->server->generateMultiStatus(iterator_to_array($this->getPropertiesIteratorResults($results, $query->select)), false);
|
||||
$data = $this->server->generateMultiStatus(iterator_to_array($this->getPropertiesIteratorResults($results,
|
||||
$query->select)), false);
|
||||
$response->setBody($data);
|
||||
return false;
|
||||
}
|
||||
|
|
@ -96,7 +97,7 @@ class SearchHandler {
|
|||
* @throws BadRequest
|
||||
*/
|
||||
private function getQueryForXML(BasicSearch $xml, array $allProps) {
|
||||
$orderBy = array_map(function(\SearchDAV\XML\Order $order) use ($allProps) {
|
||||
$orderBy = array_map(function (\SearchDAV\XML\Order $order) use ($allProps) {
|
||||
if (!isset($allProps[$order->property])) {
|
||||
throw new BadRequest('requested order by property is not a valid property for this scope');
|
||||
}
|
||||
|
|
@ -106,7 +107,7 @@ class SearchHandler {
|
|||
}
|
||||
return new Order($prop, $order->order);
|
||||
}, $xml->orderBy);
|
||||
$select = array_map(function($propName) use ($allProps) {
|
||||
$select = array_map(function ($propName) use ($allProps) {
|
||||
if (!isset($allProps[$propName])) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -130,7 +131,7 @@ class SearchHandler {
|
|||
* @throws BadRequest
|
||||
*/
|
||||
private function transformOperator(\SearchDAV\XML\Operator $operator, array $allProps) {
|
||||
$arguments = array_map(function($argument) use ($allProps) {
|
||||
$arguments = array_map(function ($argument) use ($allProps) {
|
||||
if (is_string($argument)) {
|
||||
if (!isset($allProps[$argument])) {
|
||||
throw new BadRequest('requested search property is not a valid property for this scope');
|
||||
|
|
@ -140,10 +141,12 @@ class SearchHandler {
|
|||
throw new BadRequest('requested search property is not searchable');
|
||||
}
|
||||
return $prop;
|
||||
} else if ($argument instanceof \SearchDAV\XML\Operator) {
|
||||
return $this->transformOperator($argument, $allProps);
|
||||
} else {
|
||||
return $argument;
|
||||
if ($argument instanceof \SearchDAV\XML\Operator) {
|
||||
return $this->transformOperator($argument, $allProps);
|
||||
} else {
|
||||
return $argument;
|
||||
}
|
||||
}
|
||||
}, $operator->arguments);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue