more tests

This commit is contained in:
Robin Appelman 2017-02-22 16:43:46 +01:00
commit b42b650266
13 changed files with 442 additions and 12 deletions

View file

@ -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;
}

View file

@ -49,7 +49,7 @@ class QueryDiscoverResponse extends Response {
if ($this->schema) {
$writer->writeElement('{DAV:}query-schema', [
'{DAV:basicsearchschema}' => $this->schema
'{DAV:}basicsearchschema' => $this->schema
]);
}
}

View file

@ -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) {