mirror of
https://codeberg.org/icewind/SearchDAV.git
synced 2026-06-04 01:54:07 +02:00
more tests
This commit is contained in:
parent
50b56db31b
commit
b42b650266
13 changed files with 442 additions and 12 deletions
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
namespace SearchDAV\XML;
|
||||
|
||||
use Sabre\Xml\ParseException;
|
||||
use Sabre\Xml\Reader;
|
||||
use Sabre\Xml\XmlDeserializable;
|
||||
|
||||
|
|
@ -62,10 +63,15 @@ class BasicSearch implements XmlDeserializable {
|
|||
$search = new self();
|
||||
|
||||
$elements = \Sabre\Xml\Deserializer\keyValue($reader);
|
||||
$search->select = isset($elements['{DAV:}select']) ? $elements['{DAV:}select'] : null;
|
||||
$search->from = isset($elements['{DAV:}from']) ? $elements['{DAV:}from'] : null;
|
||||
|
||||
if (!isset($elements['{DAV:}from'])) {
|
||||
throw new ParseException('Missing {DAV:}from when parsing {DAV:}basicsearch');
|
||||
}
|
||||
|
||||
$search->select = isset($elements['{DAV:}select']) ? $elements['{DAV:}select'] : [];
|
||||
$search->from = $elements['{DAV:}from'];
|
||||
$search->where = isset($elements['{DAV:}where']) ? $elements['{DAV:}where'] : null;
|
||||
$search->orderBy = isset($elements['{DAV:}orderby']) ? $elements['{DAV:}orderby'] : null;
|
||||
$search->orderBy = isset($elements['{DAV:}orderby']) ? $elements['{DAV:}orderby'] : [];
|
||||
|
||||
return $search;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class QueryDiscoverResponse extends Response {
|
|||
|
||||
if ($this->schema) {
|
||||
$writer->writeElement('{DAV:}query-schema', [
|
||||
'{DAV:basicsearchschema}' => $this->schema
|
||||
'{DAV:}basicsearchschema' => $this->schema
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,10 +53,12 @@ class Scope implements XmlDeserializable {
|
|||
/**
|
||||
* @param string $href
|
||||
* @param int|string $depth
|
||||
* @param string|null $path
|
||||
*/
|
||||
public function __construct($href = '', $depth = 1) {
|
||||
public function __construct($href = '', $depth = 1, $path = null) {
|
||||
$this->href = $href;
|
||||
$this->depth = $depth;
|
||||
$this->path = $path;
|
||||
}
|
||||
|
||||
static function xmlDeserialize(Reader $reader) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue