mirror of
https://codeberg.org/icewind/SearchDAV.git
synced 2026-06-03 09:34:08 +02:00
update sabredav and phpunit
This commit is contained in:
parent
946bc1bf69
commit
49c010f4d7
7 changed files with 22 additions and 31 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -1,2 +1,4 @@
|
||||||
composer.lock
|
composer.lock
|
||||||
vendor
|
vendor
|
||||||
|
coverage.xml
|
||||||
|
.phpunit.result.cache
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
language: php
|
language: php
|
||||||
php:
|
php:
|
||||||
- '7.1'
|
|
||||||
- '7.2'
|
- '7.2'
|
||||||
- '7.3'
|
- '7.3'
|
||||||
|
- '7.4'
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
directories:
|
directories:
|
||||||
|
|
|
||||||
|
|
@ -10,10 +10,10 @@
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=7.1",
|
"php": ">=7.1",
|
||||||
"sabre/dav": "^3.2.0"
|
"sabre/dav": "^4.0.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "^7"
|
"phpunit/phpunit": "^8"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@
|
||||||
|
|
||||||
namespace SearchDAV\Test;
|
namespace SearchDAV\Test;
|
||||||
|
|
||||||
|
|
||||||
use Sabre\DAV\INode;
|
use Sabre\DAV\INode;
|
||||||
use Sabre\DAV\SimpleFile;
|
use Sabre\DAV\SimpleFile;
|
||||||
use SearchDAV\Backend\ISearchBackend;
|
use SearchDAV\Backend\ISearchBackend;
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,8 @@
|
||||||
|
|
||||||
namespace SearchDAV\Test;
|
namespace SearchDAV\Test;
|
||||||
|
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
use Sabre\Xml\ParseException;
|
||||||
use Sabre\Xml\Service;
|
use Sabre\Xml\Service;
|
||||||
use SearchDAV\DAV\QueryParser;
|
use SearchDAV\DAV\QueryParser;
|
||||||
use SearchDAV\XML\BasicSearch;
|
use SearchDAV\XML\BasicSearch;
|
||||||
|
|
@ -49,14 +49,14 @@ class QueryParserTest extends TestCase {
|
||||||
|
|
||||||
$this->assertEquals(['{DAV:}getcontentlength'], $search->select);
|
$this->assertEquals(['{DAV:}getcontentlength'], $search->select);
|
||||||
$this->assertEquals([
|
$this->assertEquals([
|
||||||
new Scope('/container1/', 'infinity')
|
new Scope('/container1/', 'infinity'),
|
||||||
], $search->from);
|
], $search->from);
|
||||||
$this->assertEquals(new Operator(\SearchDAV\Query\Operator::OPERATION_GREATER_THAN, [
|
$this->assertEquals(new Operator(\SearchDAV\Query\Operator::OPERATION_GREATER_THAN, [
|
||||||
'{DAV:}getcontentlength',
|
'{DAV:}getcontentlength',
|
||||||
new Literal(10000)
|
new Literal(10000),
|
||||||
]), $search->where);
|
]), $search->where);
|
||||||
$this->assertEquals([
|
$this->assertEquals([
|
||||||
new Order('{DAV:}getcontentlength', \SearchDAV\Query\Order::ASC)
|
new Order('{DAV:}getcontentlength', \SearchDAV\Query\Order::ASC),
|
||||||
], $search->orderBy);
|
], $search->orderBy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -74,14 +74,14 @@ class QueryParserTest extends TestCase {
|
||||||
|
|
||||||
$this->assertEquals(['{DAV:}getcontentlength'], $search->select);
|
$this->assertEquals(['{DAV:}getcontentlength'], $search->select);
|
||||||
$this->assertEquals([
|
$this->assertEquals([
|
||||||
new Scope('/container1/', 'infinity')
|
new Scope('/container1/', 'infinity'),
|
||||||
], $search->from);
|
], $search->from);
|
||||||
$this->assertEquals(new Operator(\SearchDAV\Query\Operator::OPERATION_GREATER_THAN, [
|
$this->assertEquals(new Operator(\SearchDAV\Query\Operator::OPERATION_GREATER_THAN, [
|
||||||
'{DAV:}getcontentlength',
|
'{DAV:}getcontentlength',
|
||||||
new Literal(10000)
|
new Literal(10000),
|
||||||
]), $search->where);
|
]), $search->where);
|
||||||
$this->assertEquals([
|
$this->assertEquals([
|
||||||
new Order('{DAV:}getcontentlength', \SearchDAV\Query\Order::DESC)
|
new Order('{DAV:}getcontentlength', \SearchDAV\Query\Order::DESC),
|
||||||
], $search->orderBy);
|
], $search->orderBy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -106,12 +106,10 @@ class QueryParserTest extends TestCase {
|
||||||
$this->assertEquals([], $search->orderBy);
|
$this->assertEquals([], $search->orderBy);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @expectedException \Sabre\XML\ParseException
|
|
||||||
*/
|
|
||||||
public function testParseNoFrom() {
|
public function testParseNoFrom() {
|
||||||
$query = file_get_contents(__DIR__ . '/nofrom.xml');
|
$query = file_get_contents(__DIR__ . '/nofrom.xml');
|
||||||
$parser = new QueryParser();
|
$parser = new QueryParser();
|
||||||
|
$this->expectException(ParseException::class);
|
||||||
$parser->parse($query, null, $rootElementName);
|
$parser->parse($query, null, $rootElementName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -158,36 +156,29 @@ class QueryParserTest extends TestCase {
|
||||||
|
|
||||||
$this->assertEquals(['{DAV:}getcontentlength'], $search->select);
|
$this->assertEquals(['{DAV:}getcontentlength'], $search->select);
|
||||||
$this->assertEquals([
|
$this->assertEquals([
|
||||||
new Scope('/container1/', 'infinity')
|
new Scope('/container1/', 'infinity'),
|
||||||
], $search->from);
|
], $search->from);
|
||||||
$this->assertEquals(new Operator(\SearchDAV\Query\Operator::OPERATION_AND, [
|
$this->assertEquals(new Operator(\SearchDAV\Query\Operator::OPERATION_AND, [
|
||||||
new Operator(\SearchDAV\Query\Operator::OPERATION_GREATER_THAN, [
|
new Operator(\SearchDAV\Query\Operator::OPERATION_GREATER_THAN, [
|
||||||
'{DAV:}getcontentlength',
|
'{DAV:}getcontentlength',
|
||||||
new Literal(10000)
|
new Literal(10000),
|
||||||
]),
|
]),
|
||||||
new Operator(\SearchDAV\Query\Operator::OPERATION_LESS_THAN, [
|
new Operator(\SearchDAV\Query\Operator::OPERATION_LESS_THAN, [
|
||||||
'{DAV:}getcontentlength',
|
'{DAV:}getcontentlength',
|
||||||
new Literal(90000)
|
new Literal(90000),
|
||||||
]),
|
]),
|
||||||
new Operator(\SearchDAV\Query\Operator::OPERATION_CONTAINS, [
|
new Operator(\SearchDAV\Query\Operator::OPERATION_CONTAINS, [
|
||||||
'Peter Forsberg'
|
'Peter Forsberg',
|
||||||
]),
|
]),
|
||||||
]), $search->where);
|
]), $search->where);
|
||||||
$this->assertEquals([
|
$this->assertEquals([
|
||||||
new Order('{DAV:}getcontentlength', \SearchDAV\Query\Order::ASC)
|
new Order('{DAV:}getcontentlength', \SearchDAV\Query\Order::ASC),
|
||||||
], $search->orderBy);
|
], $search->orderBy);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function testParseWhereBroken() {
|
||||||
* @expectedException \Sabre\Xml\LibXMLException
|
|
||||||
* @expectedExceptionMessage Opening and ending tag mismatch: prop line 17 and gt
|
|
||||||
* on line 19, column 20
|
|
||||||
*
|
|
||||||
* @throws \Sabre\Xml\ParseException
|
|
||||||
*/
|
|
||||||
public function testParseWhereBroken()
|
|
||||||
{
|
|
||||||
$query = file_get_contents(__DIR__ . '/invalidwherebroken.xml');
|
$query = file_get_contents(__DIR__ . '/invalidwherebroken.xml');
|
||||||
|
$this->expectException(ParseException::class);
|
||||||
(new QueryParser())->parse($query, null, $rootElementName);
|
(new QueryParser())->parse($query, null, $rootElementName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@
|
||||||
|
|
||||||
namespace SearchDAV\Test;
|
namespace SearchDAV\Test;
|
||||||
|
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Sabre\DAV\FS\Directory;
|
use Sabre\DAV\FS\Directory;
|
||||||
use Sabre\DAV\INode;
|
use Sabre\DAV\INode;
|
||||||
|
|
@ -44,7 +43,7 @@ class SearchPluginTest extends TestCase {
|
||||||
/** @var ISearchBackend|\PHPUnit_Framework_MockObject_MockObject */
|
/** @var ISearchBackend|\PHPUnit_Framework_MockObject_MockObject */
|
||||||
private $searchBackend;
|
private $searchBackend;
|
||||||
|
|
||||||
protected function setUp() {
|
protected function setUp(): void {
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
$this->searchBackend = $this->getMockBuilder(ISearchBackend::class)
|
$this->searchBackend = $this->getMockBuilder(ISearchBackend::class)
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require '../vendor/autoload.php';
|
require __DIR__ . '/../vendor/autoload.php';
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue