From 66effbfe0827fc61fff6d248797a894213ad20d6 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sat, 28 May 2016 17:46:24 +0200 Subject: upgrade to sabre32 --- .../sabre/dav/tests/Sabre/DAV/AbstractServer.php | 12 +- .../Sabre/DAV/Auth/Backend/AbstractBasicTest.php | 13 +- .../Sabre/DAV/Auth/Backend/AbstractDigestTest.php | 11 +- .../Sabre/DAV/Auth/Backend/AbstractPDOTest.php | 20 +- .../tests/Sabre/DAV/Auth/Backend/ApacheTest.php | 1 - .../dav/tests/Sabre/DAV/Auth/Backend/FileTest.php | 12 +- .../dav/tests/Sabre/DAV/Auth/Backend/Mock.php | 6 +- .../tests/Sabre/DAV/Auth/Backend/PDOMySQLTest.php | 26 +- .../tests/Sabre/DAV/Auth/Backend/PDOSqliteTest.php | 23 +- .../sabre/dav/tests/Sabre/DAV/Auth/PluginTest.php | 30 +- vendor/sabre/dav/tests/Sabre/DAV/BasicNodeTest.php | 64 ++--- .../Sabre/DAV/Browser/GuessContentTypeTest.php | 44 +-- .../Sabre/DAV/Browser/MapGetToPropFindTest.php | 16 +- .../dav/tests/Sabre/DAV/Browser/PluginTest.php | 54 ++-- vendor/sabre/dav/tests/Sabre/DAV/ClientMock.php | 4 +- .../dav/tests/Sabre/DAV/Exception/LockedTest.php | 9 +- vendor/sabre/dav/tests/Sabre/DAV/ExceptionTest.php | 8 +- .../sabre/dav/tests/Sabre/DAV/FSExt/FileTest.php | 18 +- .../sabre/dav/tests/Sabre/DAV/FSExt/ServerTest.php | 64 ++--- .../sabre/dav/tests/Sabre/DAV/HttpDeleteTest.php | 20 +- vendor/sabre/dav/tests/Sabre/DAV/HttpPutTest.php | 26 +- vendor/sabre/dav/tests/Sabre/DAV/Issue33Test.php | 28 +- .../tests/Sabre/DAV/Locks/Backend/AbstractTest.php | 40 +-- .../tests/Sabre/DAV/Locks/Backend/PDOMySQLTest.php | 27 +- .../dav/tests/Sabre/DAV/Locks/Backend/PDOTest.php | 21 +- .../sabre/dav/tests/Sabre/DAV/Locks/MSWordTest.php | 14 +- .../sabre/dav/tests/Sabre/DAV/Locks/PluginTest.php | 312 ++++++++++----------- .../sabre/dav/tests/Sabre/DAV/Mount/PluginTest.php | 16 +- .../sabre/dav/tests/Sabre/DAV/ObjectTreeTest.php | 48 ++-- .../dav/tests/Sabre/DAV/PartialUpdate/FileMock.php | 5 +- .../Sabre/DAV/PartialUpdate/SpecificationTest.php | 44 +-- .../sabre/dav/tests/Sabre/DAV/ServerMKCOLTest.php | 192 +++++++------ .../sabre/dav/tests/Sabre/DAV/ServerPluginTest.php | 29 +- .../dav/tests/Sabre/DAV/ServerPreconditionTest.php | 112 ++++---- .../sabre/dav/tests/Sabre/DAV/ServerSimpleTest.php | 2 +- .../tests/Sabre/DAV/ServerUpdatePropertiesTest.php | 63 ++--- .../sabre/dav/tests/Sabre/DAV/SimpleFileTest.php | 2 +- .../sabre/dav/tests/Sabre/DAV/StringUtilTest.php | 106 +++---- .../tests/Sabre/DAV/TemporaryFileFilterTest.php | 70 ++--- vendor/sabre/dav/tests/Sabre/DAV/TestPlugin.php | 7 +- vendor/sabre/dav/tests/Sabre/DAV/TreeTest.php | 24 +- 41 files changed, 787 insertions(+), 856 deletions(-) (limited to 'vendor/sabre/dav/tests/Sabre/DAV') diff --git a/vendor/sabre/dav/tests/Sabre/DAV/AbstractServer.php b/vendor/sabre/dav/tests/Sabre/DAV/AbstractServer.php index b5b8d64ee..6a8d389a0 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/AbstractServer.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/AbstractServer.php @@ -24,7 +24,7 @@ abstract class AbstractServer extends \PHPUnit_Framework_TestCase { $this->server->sapi = new HTTP\SapiMock(); $this->server->httpResponse = $this->response; $this->server->debugExceptions = true; - $this->deleteTree(SABRE_TEMPDIR,false); + $this->deleteTree(SABRE_TEMPDIR, false); file_put_contents(SABRE_TEMPDIR . '/test.txt', 'Test contents'); mkdir(SABRE_TEMPDIR . '/dir'); file_put_contents(SABRE_TEMPDIR . '/dir/child.txt', 'Child contents'); @@ -34,7 +34,7 @@ abstract class AbstractServer extends \PHPUnit_Framework_TestCase { function tearDown() { - $this->deleteTree(SABRE_TEMPDIR,false); + $this->deleteTree(SABRE_TEMPDIR, false); } @@ -44,12 +44,12 @@ abstract class AbstractServer extends \PHPUnit_Framework_TestCase { } - private function deleteTree($path,$deleteRoot = true) { + private function deleteTree($path, $deleteRoot = true) { - foreach(scandir($path) as $node) { + foreach (scandir($path) as $node) { - if ($node=='.' || $node=='.svn' || $node=='..') continue; - $myPath = $path.'/'. $node; + if ($node == '.' || $node == '.svn' || $node == '..') continue; + $myPath = $path . '/' . $node; if (is_file($myPath)) { unlink($myPath); } else { diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractBasicTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractBasicTest.php index 7d7a59898..455403aff 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractBasicTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractBasicTest.php @@ -2,7 +2,6 @@ namespace Sabre\DAV\Auth\Backend; -use Sabre\DAV; use Sabre\HTTP; class AbstractBasicTest extends \PHPUnit_Framework_TestCase { @@ -22,10 +21,10 @@ class AbstractBasicTest extends \PHPUnit_Framework_TestCase { function testCheckUnknownUser() { - $request = HTTP\Sapi::createFromServerArray(array( + $request = HTTP\Sapi::createFromServerArray([ 'PHP_AUTH_USER' => 'username', - 'PHP_AUTH_PW' => 'wrongpassword', - )); + 'PHP_AUTH_PW' => 'wrongpassword', + ]); $response = new HTTP\Response(); $backend = new AbstractBasicMock(); @@ -38,10 +37,10 @@ class AbstractBasicTest extends \PHPUnit_Framework_TestCase { function testCheckSuccess() { - $request = HTTP\Sapi::createFromServerArray(array( + $request = HTTP\Sapi::createFromServerArray([ 'PHP_AUTH_USER' => 'username', - 'PHP_AUTH_PW' => 'password', - )); + 'PHP_AUTH_PW' => 'password', + ]); $response = new HTTP\Response(); $backend = new AbstractBasicMock(); diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractDigestTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractDigestTest.php index 8ef416c37..14c72aaa0 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractDigestTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractDigestTest.php @@ -2,7 +2,6 @@ namespace Sabre\DAV\Auth\Backend; -use Sabre\DAV; use Sabre\HTTP; class AbstractDigestTest extends \PHPUnit_Framework_TestCase { @@ -87,12 +86,12 @@ class AbstractDigestTest extends \PHPUnit_Framework_TestCase { function testCheck() { $digestHash = md5('HELLO:12345:1:1:auth:' . md5('GET:/')); - $header = 'username=user, realm=myRealm, nonce=12345, uri=/, response='.$digestHash.', opaque=1, qop=auth, nc=1, cnonce=1'; - $request = HTTP\Sapi::createFromServerArray(array( + $header = 'username=user, realm=myRealm, nonce=12345, uri=/, response=' . $digestHash . ', opaque=1, qop=auth, nc=1, cnonce=1'; + $request = HTTP\Sapi::createFromServerArray([ 'REQUEST_METHOD' => 'GET', 'PHP_AUTH_DIGEST' => $header, 'REQUEST_URI' => '/', - )); + ]); $response = new HTTP\Response(); @@ -127,10 +126,10 @@ class AbstractDigestMock extends AbstractDigest { function getDigestHash($realm, $userName) { - switch($userName) { + switch ($userName) { case 'null' : return null; case 'false' : return false; - case 'array' : return array(); + case 'array' : return []; case 'user' : return 'HELLO'; } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractPDOTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractPDOTest.php index d22923d51..b14e9fa2e 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractPDOTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractPDOTest.php @@ -2,11 +2,21 @@ namespace Sabre\DAV\Auth\Backend; -use Sabre\DAV; - abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { - abstract function getPDO(); + use \Sabre\DAV\DbTestHelperTrait; + + function setUp() { + + $this->dropTables('users'); + $this->createSchema('users'); + + $this->getPDO()->query( + "INSERT INTO users (username,digesta1) VALUES ('user','hash')" + + ); + + } function testConstruct() { @@ -24,11 +34,11 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase { $pdo = $this->getPDO(); $backend = new PDO($pdo); - $this->assertNull($backend->getDigestHash('realm','blabla')); + $this->assertNull($backend->getDigestHash('realm', 'blabla')); $expected = 'hash'; - $this->assertEquals($expected, $backend->getDigestHash('realm','user')); + $this->assertEquals($expected, $backend->getDigestHash('realm', 'user')); } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/ApacheTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/ApacheTest.php index 697b593db..29cbc2162 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/ApacheTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/ApacheTest.php @@ -2,7 +2,6 @@ namespace Sabre\DAV\Auth\Backend; -use Sabre\DAV; use Sabre\HTTP; class ApacheTest extends \PHPUnit_Framework_TestCase { diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/FileTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/FileTest.php index d2e5fe49b..9b66d642f 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/FileTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/FileTest.php @@ -6,7 +6,7 @@ class FileTest extends \PHPUnit_Framework_TestCase { function tearDown() { - if (file_exists(SABRE_TEMPDIR . '/filebackend')) unlink(SABRE_TEMPDIR .'/filebackend'); + if (file_exists(SABRE_TEMPDIR . '/filebackend')) unlink(SABRE_TEMPDIR . '/filebackend'); } @@ -22,20 +22,20 @@ class FileTest extends \PHPUnit_Framework_TestCase { */ function testLoadFileBroken() { - file_put_contents(SABRE_TEMPDIR . '/backend','user:realm:hash'); + file_put_contents(SABRE_TEMPDIR . '/backend', 'user:realm:hash'); $file = new File(); - $file->loadFile(SABRE_TEMPDIR .'/backend'); + $file->loadFile(SABRE_TEMPDIR . '/backend'); } function testLoadFile() { - file_put_contents(SABRE_TEMPDIR . '/backend','user:realm:' . md5('user:realm:password')); + file_put_contents(SABRE_TEMPDIR . '/backend', 'user:realm:' . md5('user:realm:password')); $file = new File(); $file->loadFile(SABRE_TEMPDIR . '/backend'); - $this->assertFalse($file->getDigestHash('realm','blabla')); - $this->assertEquals(md5('user:realm:password'), $file->getDigestHash('realm','user')); + $this->assertFalse($file->getDigestHash('realm', 'blabla')); + $this->assertEquals(md5('user:realm:password'), $file->getDigestHash('realm', 'user')); } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/Mock.php b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/Mock.php index a782cb74d..b30b3f143 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/Mock.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/Mock.php @@ -2,10 +2,8 @@ namespace Sabre\DAV\Auth\Backend; -use - Sabre\DAV, - Sabre\HTTP\RequestInterface, - Sabre\HTTP\ResponseInterface; +use Sabre\HTTP\RequestInterface; +use Sabre\HTTP\ResponseInterface; class Mock implements BackendInterface { diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/PDOMySQLTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/PDOMySQLTest.php index 8de2be667..18f59793a 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/PDOMySQLTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/PDOMySQLTest.php @@ -2,32 +2,8 @@ namespace Sabre\DAV\Auth\Backend; -require_once 'Sabre/TestUtil.php'; - class PDOMySQLTest extends AbstractPDOTest { - function getPDO() { - - if (!SABRE_HASMYSQL) $this->markTestSkipped('MySQL driver is not available, or not properly configured'); - $pdo = \Sabre\TestUtil::getMySQLDB(); - if (!$pdo) $this->markTestSkipped('Could not connect to MySQL database'); - $pdo->query("DROP TABLE IF EXISTS users"); - $pdo->query(<<query("INSERT INTO users (username,digesta1,email,displayname) VALUES ('user','hash','user@example.org','User')"); - - return $pdo; - - } + public $driver = 'mysql'; } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/PDOSqliteTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/PDOSqliteTest.php index abfb031bb..b1f382237 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/PDOSqliteTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/PDOSqliteTest.php @@ -2,27 +2,8 @@ namespace Sabre\DAV\Auth\Backend; -require_once 'Sabre/DAV/Auth/Backend/AbstractPDOTest.php'; +class PDOSqliteTest extends AbstractPDOTest { -class PDOSQLiteTest extends AbstractPDOTest { - - function tearDown() { - - if (file_exists(SABRE_TEMPDIR . '/pdobackend')) unlink(SABRE_TEMPDIR . '/pdobackend'); - if (file_exists(SABRE_TEMPDIR . '/pdobackend2')) unlink(SABRE_TEMPDIR . '/pdobackend2'); - - } - - function getPDO() { - - if (!SABRE_HASSQLITE) $this->markTestSkipped('SQLite driver is not available'); - $pdo = new \PDO('sqlite:'.SABRE_TEMPDIR.'/pdobackend'); - $pdo->setAttribute(\PDO::ATTR_ERRMODE,\PDO::ERRMODE_EXCEPTION); - $pdo->query('CREATE TABLE users (username TEXT, digesta1 TEXT, email VARCHAR(80), displayname VARCHAR(80))'); - $pdo->query('INSERT INTO users VALUES ("user","hash","user@example.org","User")'); - - return $pdo; - - } + public $driver = 'sqlite'; } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Auth/PluginTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Auth/PluginTest.php index 0ac9e0613..3ed79a7da 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/PluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Auth/PluginTest.php @@ -5,13 +5,11 @@ namespace Sabre\DAV\Auth; use Sabre\HTTP; use Sabre\DAV; -require_once 'Sabre/HTTP/ResponseMock.php'; - class PluginTest extends \PHPUnit_Framework_TestCase { function testInit() { - $fakeServer = new DAV\Server( new DAV\SimpleCollection('bla')); + $fakeServer = new DAV\Server(new DAV\SimpleCollection('bla')); $plugin = new Plugin(new Backend\Mock()); $this->assertTrue($plugin instanceof Plugin); $fakeServer->addPlugin($plugin); @@ -25,7 +23,7 @@ class PluginTest extends \PHPUnit_Framework_TestCase { */ function testAuthenticate() { - $fakeServer = new DAV\Server( new DAV\SimpleCollection('bla')); + $fakeServer = new DAV\Server(new DAV\SimpleCollection('bla')); $plugin = new Plugin(new Backend\Mock()); $fakeServer->addPlugin($plugin); $this->assertTrue( @@ -40,7 +38,7 @@ class PluginTest extends \PHPUnit_Framework_TestCase { */ function testAuthenticateFail() { - $fakeServer = new DAV\Server( new DAV\SimpleCollection('bla')); + $fakeServer = new DAV\Server(new DAV\SimpleCollection('bla')); $backend = new Backend\Mock(); $backend->fail = true; @@ -55,7 +53,7 @@ class PluginTest extends \PHPUnit_Framework_TestCase { */ function testMultipleBackend() { - $fakeServer = new DAV\Server( new DAV\SimpleCollection('bla')); + $fakeServer = new DAV\Server(new DAV\SimpleCollection('bla')); $backend1 = new Backend\Mock(); $backend2 = new Backend\Mock(); $backend2->fail = true; @@ -77,7 +75,7 @@ class PluginTest extends \PHPUnit_Framework_TestCase { */ function testNoAuthBackend() { - $fakeServer = new DAV\Server( new DAV\SimpleCollection('bla')); + $fakeServer = new DAV\Server(new DAV\SimpleCollection('bla')); $plugin = new Plugin(); $fakeServer->addPlugin($plugin); @@ -90,7 +88,7 @@ class PluginTest extends \PHPUnit_Framework_TestCase { */ function testInvalidCheckResponse() { - $fakeServer = new DAV\Server( new DAV\SimpleCollection('bla')); + $fakeServer = new DAV\Server(new DAV\SimpleCollection('bla')); $backend = new Backend\Mock(); $backend->invalidCheckResponse = true; @@ -105,7 +103,7 @@ class PluginTest extends \PHPUnit_Framework_TestCase { */ function testGetCurrentPrincipal() { - $fakeServer = new DAV\Server( new DAV\SimpleCollection('bla')); + $fakeServer = new DAV\Server(new DAV\SimpleCollection('bla')); $plugin = new Plugin(new Backend\Mock()); $fakeServer->addPlugin($plugin); $fakeServer->emit('beforeMethod', [new HTTP\Request(), new HTTP\Response()]); @@ -113,18 +111,4 @@ class PluginTest extends \PHPUnit_Framework_TestCase { } - /** - * @depends testAuthenticate - */ - function testGetCurrentUser() { - - $fakeServer = new DAV\Server( new DAV\SimpleCollection('bla')); - $plugin = new Plugin(new Backend\Mock()); - $fakeServer->addPlugin($plugin); - $fakeServer->emit('beforeMethod', [new HTTP\Request(), new HTTP\Response()]); - $this->assertEquals('admin', $plugin->getCurrentUser()); - - } - } - diff --git a/vendor/sabre/dav/tests/Sabre/DAV/BasicNodeTest.php b/vendor/sabre/dav/tests/Sabre/DAV/BasicNodeTest.php index 155c785f8..ec104ec80 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/BasicNodeTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/BasicNodeTest.php @@ -7,7 +7,7 @@ class BasicNodeTest extends \PHPUnit_Framework_TestCase { /** * @expectedException Sabre\DAV\Exception\Forbidden */ - public function testPut() { + function testPut() { $file = new FileMock(); $file->put('hi'); @@ -17,29 +17,29 @@ class BasicNodeTest extends \PHPUnit_Framework_TestCase { /** * @expectedException Sabre\DAV\Exception\Forbidden */ - public function testGet() { + function testGet() { $file = new FileMock(); $file->get(); } - public function testGetSize() { + function testGetSize() { $file = new FileMock(); - $this->assertEquals(0,$file->getSize()); + $this->assertEquals(0, $file->getSize()); } - public function testGetETag() { + function testGetETag() { $file = new FileMock(); $this->assertNull($file->getETag()); } - public function testGetContentType() { + function testGetContentType() { $file = new FileMock(); $this->assertNull($file->getContentType()); @@ -49,7 +49,7 @@ class BasicNodeTest extends \PHPUnit_Framework_TestCase { /** * @expectedException Sabre\DAV\Exception\Forbidden */ - public function testDelete() { + function testDelete() { $file = new FileMock(); $file->delete(); @@ -59,24 +59,24 @@ class BasicNodeTest extends \PHPUnit_Framework_TestCase { /** * @expectedException Sabre\DAV\Exception\Forbidden */ - public function testSetName() { + function testSetName() { $file = new FileMock(); $file->setName('hi'); } - public function testGetLastModified() { + function testGetLastModified() { $file = new FileMock(); // checking if lastmod is within the range of a few seconds $lastMod = $file->getLastModified(); - $compareTime = ($lastMod + 1)-time(); + $compareTime = ($lastMod + 1) - time(); $this->assertTrue($compareTime < 3); } - public function testGetChild() { + function testGetChild() { $dir = new DirectoryMock(); $file = $dir->getChild('mockfile'); @@ -84,14 +84,14 @@ class BasicNodeTest extends \PHPUnit_Framework_TestCase { } - public function testChildExists() { + function testChildExists() { $dir = new DirectoryMock(); $this->assertTrue($dir->childExists('mockfile')); } - public function testChildExistsFalse() { + function testChildExistsFalse() { $dir = new DirectoryMock(); $this->assertFalse($dir->childExists('mockfile2')); @@ -101,7 +101,7 @@ class BasicNodeTest extends \PHPUnit_Framework_TestCase { /** * @expectedException Sabre\DAV\Exception\NotFound */ - public function testGetChild404() { + function testGetChild404() { $dir = new DirectoryMock(); $file = $dir->getChild('blabla'); @@ -111,26 +111,26 @@ class BasicNodeTest extends \PHPUnit_Framework_TestCase { /** * @expectedException Sabre\DAV\Exception\Forbidden */ - public function testCreateFile() { + function testCreateFile() { $dir = new DirectoryMock(); - $dir->createFile('hello','data'); + $dir->createFile('hello', 'data'); } /** * @expectedException Sabre\DAV\Exception\Forbidden */ - public function testCreateDirectory() { + function testCreateDirectory() { $dir = new DirectoryMock(); $dir->createDirectory('hello'); } - public function testSimpleDirectoryConstruct() { + function testSimpleDirectoryConstruct() { - $dir = new SimpleCollection('simpledir',array()); + $dir = new SimpleCollection('simpledir', []); $this->assertInstanceOf('Sabre\DAV\SimpleCollection', $dir); } @@ -138,13 +138,13 @@ class BasicNodeTest extends \PHPUnit_Framework_TestCase { /** * @depends testSimpleDirectoryConstruct */ - public function testSimpleDirectoryConstructChild() { + function testSimpleDirectoryConstructChild() { $file = new FileMock(); - $dir = new SimpleCollection('simpledir',array($file)); + $dir = new SimpleCollection('simpledir', [$file]); $file2 = $dir->getChild('mockfile'); - $this->assertEquals($file,$file2); + $this->assertEquals($file, $file2); } @@ -152,23 +152,23 @@ class BasicNodeTest extends \PHPUnit_Framework_TestCase { * @expectedException Sabre\DAV\Exception * @depends testSimpleDirectoryConstruct */ - public function testSimpleDirectoryBadParam() { + function testSimpleDirectoryBadParam() { - $dir = new SimpleCollection('simpledir',array('string shouldn\'t be here')); + $dir = new SimpleCollection('simpledir', ['string shouldn\'t be here']); } /** * @depends testSimpleDirectoryConstruct */ - public function testSimpleDirectoryAddChild() { + function testSimpleDirectoryAddChild() { $file = new FileMock(); $dir = new SimpleCollection('simpledir'); $dir->addChild($file); $file2 = $dir->getChild('mockfile'); - $this->assertEquals($file,$file2); + $this->assertEquals($file, $file2); } @@ -176,23 +176,23 @@ class BasicNodeTest extends \PHPUnit_Framework_TestCase { * @depends testSimpleDirectoryConstruct * @depends testSimpleDirectoryAddChild */ - public function testSimpleDirectoryGetChildren() { + function testSimpleDirectoryGetChildren() { $file = new FileMock(); $dir = new SimpleCollection('simpledir'); $dir->addChild($file); - $this->assertEquals(array($file),$dir->getChildren()); + $this->assertEquals([$file], $dir->getChildren()); } /* * @depends testSimpleDirectoryConstruct */ - public function testSimpleDirectoryGetName() { + function testSimpleDirectoryGetName() { $dir = new SimpleCollection('simpledir'); - $this->assertEquals('simpledir',$dir->getName()); + $this->assertEquals('simpledir', $dir->getName()); } @@ -200,7 +200,7 @@ class BasicNodeTest extends \PHPUnit_Framework_TestCase { * @depends testSimpleDirectoryConstruct * @expectedException Sabre\DAV\Exception\NotFound */ - public function testSimpleDirectoryGetChild404() { + function testSimpleDirectoryGetChild404() { $dir = new SimpleCollection('simpledir'); $dir->getChild('blabla'); @@ -218,7 +218,7 @@ class DirectoryMock extends Collection { function getChildren() { - return array(new FileMock()); + return [new FileMock()]; } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Browser/GuessContentTypeTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Browser/GuessContentTypeTest.php index 157c2170a..54a3053ec 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Browser/GuessContentTypeTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Browser/GuessContentTypeTest.php @@ -11,8 +11,8 @@ class GuessContentTypeTest extends DAV\AbstractServer { parent::setUp(); \Sabre\TestUtil::clearTempDir(); - file_put_contents(SABRE_TEMPDIR . '/somefile.jpg','blabla'); - file_put_contents(SABRE_TEMPDIR . '/somefile.hoi','blabla'); + file_put_contents(SABRE_TEMPDIR . '/somefile.jpg', 'blabla'); + file_put_contents(SABRE_TEMPDIR . '/somefile.hoi', 'blabla'); } @@ -24,13 +24,13 @@ class GuessContentTypeTest extends DAV\AbstractServer { function testGetProperties() { - $properties = array( + $properties = [ '{DAV:}getcontenttype', - ); - $result = $this->server->getPropertiesForPath('/somefile.jpg',$properties); - $this->assertArrayHasKey(0,$result); - $this->assertArrayHasKey(404,$result[0]); - $this->assertArrayHasKey('{DAV:}getcontenttype',$result[0][404]); + ]; + $result = $this->server->getPropertiesForPath('/somefile.jpg', $properties); + $this->assertArrayHasKey(0, $result); + $this->assertArrayHasKey(404, $result[0]); + $this->assertArrayHasKey('{DAV:}getcontenttype', $result[0][404]); } @@ -40,14 +40,14 @@ class GuessContentTypeTest extends DAV\AbstractServer { function testGetPropertiesPluginEnabled() { $this->server->addPlugin(new GuessContentType()); - $properties = array( + $properties = [ '{DAV:}getcontenttype', - ); - $result = $this->server->getPropertiesForPath('/somefile.jpg',$properties); - $this->assertArrayHasKey(0,$result); - $this->assertArrayHasKey(200,$result[0], 'We received: ' . print_r($result,true)); - $this->assertArrayHasKey('{DAV:}getcontenttype',$result[0][200]); - $this->assertEquals('image/jpeg',$result[0][200]['{DAV:}getcontenttype']); + ]; + $result = $this->server->getPropertiesForPath('/somefile.jpg', $properties); + $this->assertArrayHasKey(0, $result); + $this->assertArrayHasKey(200, $result[0], 'We received: ' . print_r($result, true)); + $this->assertArrayHasKey('{DAV:}getcontenttype', $result[0][200]); + $this->assertEquals('image/jpeg', $result[0][200]['{DAV:}getcontenttype']); } @@ -57,14 +57,14 @@ class GuessContentTypeTest extends DAV\AbstractServer { function testGetPropertiesUnknown() { $this->server->addPlugin(new GuessContentType()); - $properties = array( + $properties = [ '{DAV:}getcontenttype', - ); - $result = $this->server->getPropertiesForPath('/somefile.hoi',$properties); - $this->assertArrayHasKey(0,$result); - $this->assertArrayHasKey(200,$result[0]); - $this->assertArrayHasKey('{DAV:}getcontenttype',$result[0][200]); - $this->assertEquals('application/octet-stream',$result[0][200]['{DAV:}getcontenttype']); + ]; + $result = $this->server->getPropertiesForPath('/somefile.hoi', $properties); + $this->assertArrayHasKey(0, $result); + $this->assertArrayHasKey(200, $result[0]); + $this->assertArrayHasKey('{DAV:}getcontenttype', $result[0][200]); + $this->assertEquals('application/octet-stream', $result[0][200]['{DAV:}getcontenttype']); } } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Browser/MapGetToPropFindTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Browser/MapGetToPropFindTest.php index 9d9fbb319..33c4ede96 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Browser/MapGetToPropFindTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Browser/MapGetToPropFindTest.php @@ -18,23 +18,23 @@ class MapGetToPropFindTest extends DAV\AbstractServer { function testCollectionGet() { - $serverVars = array( + $serverVars = [ 'REQUEST_URI' => '/', 'REQUEST_METHOD' => 'GET', - ); + ]; $request = HTTP\Sapi::createFromServerArray($serverVars); $request->setBody(''); $this->server->httpRequest = ($request); $this->server->exec(); - $this->assertEquals(207, $this->response->status,'Incorrect status response received. Full response body: ' . $this->response->body); - $this->assertEquals(array( + $this->assertEquals(207, $this->response->status, 'Incorrect status response received. Full response body: ' . $this->response->body); + $this->assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - 'DAV' => ['1, 3, extended-mkcol'], - 'Vary' => ['Brief,Prefer'], - ), + 'Content-Type' => ['application/xml; charset=utf-8'], + 'DAV' => ['1, 3, extended-mkcol'], + 'Vary' => ['Brief,Prefer'], + ], $this->response->getHeaders() ); diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Browser/PluginTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Browser/PluginTest.php index 00beea9f2..f20c50f86 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Browser/PluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Browser/PluginTest.php @@ -28,16 +28,16 @@ class PluginTest extends DAV\AbstractServer{ $this->assertEquals(200, $this->response->getStatus(), "Incorrect status received. Full response body: " . $this->response->getBodyAsString()); $this->assertEquals( [ - 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['text/html; charset=utf-8'], - 'Content-Security-Policy' => ["img-src 'self'; style-src 'self';"] + 'X-Sabre-Version' => [DAV\Version::VERSION], + 'Content-Type' => ['text/html; charset=utf-8'], + 'Content-Security-Policy' => ["default-src 'none'; img-src 'self'; style-src 'self'; font-src 'self';"] ], $this->response->getHeaders() ); $body = $this->response->getBodyAsString(); $this->assertTrue(strpos($body, 'dir') !== false, $body); - $this->assertTrue(strpos($body, '<a href="/dir/child.txt">')!==false); + $this->assertTrue(strpos($body, '<a href="/dir/child.txt">') !== false); } @@ -54,16 +54,16 @@ class PluginTest extends DAV\AbstractServer{ $this->assertEquals(200, $this->response->getStatus(), "Incorrect status received. Full response body: " . $this->response->getBodyAsString()); $this->assertEquals( [ - 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['text/html; charset=utf-8'], - 'Content-Security-Policy' => ["img-src 'self'; style-src 'self';"] + 'X-Sabre-Version' => [DAV\Version::VERSION], + 'Content-Type' => ['text/html; charset=utf-8'], + 'Content-Security-Policy' => ["default-src 'none'; img-src 'self'; style-src 'self'; font-src 'self';"] ], $this->response->getHeaders() ); $body = $this->response->getBodyAsString(); $this->assertTrue(strpos($body, '<title>dir') !== false, $body); - $this->assertTrue(strpos($body, '<a href="/dir/child.txt">')!==false); + $this->assertTrue(strpos($body, '<a href="/dir/child.txt">') !== false); } function testCollectionGetRoot() { @@ -75,17 +75,17 @@ class PluginTest extends DAV\AbstractServer{ $this->assertEquals(200, $this->response->status, "Incorrect status received. Full response body: " . $this->response->getBodyAsString()); $this->assertEquals( [ - 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['text/html; charset=utf-8'], - 'Content-Security-Policy' => ["img-src 'self'; style-src 'self';"] + 'X-Sabre-Version' => [DAV\Version::VERSION], + 'Content-Type' => ['text/html; charset=utf-8'], + 'Content-Security-Policy' => ["default-src 'none'; img-src 'self'; style-src 'self'; font-src 'self';"] ], $this->response->getHeaders() ); $body = $this->response->getBodyAsString(); $this->assertTrue(strpos($body, '<title>/') !== false, $body); - $this->assertTrue(strpos($body, '<a href="/dir/">')!==false); - $this->assertTrue(strpos($body, '<span class="btn disabled">')!==false); + $this->assertTrue(strpos($body, '<a href="/dir/">') !== false); + $this->assertTrue(strpos($body, '<span class="btn disabled">') !== false); } @@ -122,15 +122,15 @@ class PluginTest extends DAV\AbstractServer{ function testPostMkCol() { - $serverVars = array( + $serverVars = [ 'REQUEST_URI' => '/', 'REQUEST_METHOD' => 'POST', - 'CONTENT_TYPE' => 'application/x-www-form-urlencoded', - ); - $postVars = array( + 'CONTENT_TYPE' => 'application/x-www-form-urlencoded', + ]; + $postVars = [ 'sabreAction' => 'mkcol', - 'name' => 'new_collection', - ); + 'name' => 'new_collection', + ]; $request = HTTP\Sapi::createFromServerArray($serverVars); $request->setPostData($postVars); @@ -138,10 +138,10 @@ class PluginTest extends DAV\AbstractServer{ $this->server->exec(); $this->assertEquals(302, $this->response->status); - $this->assertEquals(array( + $this->assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Location' => ['/'], - ), $this->response->getHeaders()); + 'Location' => ['/'], + ], $this->response->getHeaders()); $this->assertTrue(is_dir(SABRE_TEMPDIR . '/new_collection')); @@ -155,11 +155,11 @@ class PluginTest extends DAV\AbstractServer{ $this->assertEquals(200, $this->response->getStatus(), 'Error: ' . $this->response->body); $this->assertEquals([ - 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['image/vnd.microsoft.icon'], - 'Content-Length' => ['4286'], - 'Cache-Control' => ['public, max-age=1209600'], - 'Content-Security-Policy' => ["img-src 'self'; style-src 'self';"] + 'X-Sabre-Version' => [DAV\Version::VERSION], + 'Content-Type' => ['image/vnd.microsoft.icon'], + 'Content-Length' => ['4286'], + 'Cache-Control' => ['public, max-age=1209600'], + 'Content-Security-Policy' => ["default-src 'none'; img-src 'self'; style-src 'self'; font-src 'self';"] ], $this->response->getHeaders()); } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ClientMock.php b/vendor/sabre/dav/tests/Sabre/DAV/ClientMock.php index d8b53a5a1..5a48b063c 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/ClientMock.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/ClientMock.php @@ -18,13 +18,13 @@ class ClientMock extends Client { * @param string $url * @return string */ - public function getAbsoluteUrl($url) { + function getAbsoluteUrl($url) { return parent::getAbsoluteUrl($url); } - public function doRequest(RequestInterface $request) { + function doRequest(RequestInterface $request) { $this->request = $request; return $this->response; diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Exception/LockedTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Exception/LockedTest.php index c06d6aa1f..8788475cb 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Exception/LockedTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Exception/LockedTest.php @@ -2,9 +2,8 @@ namespace Sabre\DAV\Exception; -use - Sabre\DAV, - DOMDocument; +use Sabre\DAV; +use DOMDocument; class LockedTest extends \PHPUnit_Framework_TestCase { @@ -15,7 +14,7 @@ class LockedTest extends \PHPUnit_Framework_TestCase { $root = $dom->createElement('d:root'); $dom->appendChild($root); - $root->setAttribute('xmlns:d','DAV:'); + $root->setAttribute('xmlns:d', 'DAV:'); $lockInfo = new DAV\Locks\LockInfo(); $lockInfo->uri = '/foo'; @@ -44,7 +43,7 @@ class LockedTest extends \PHPUnit_Framework_TestCase { $root = $dom->createElement('d:root'); $dom->appendChild($root); - $root->setAttribute('xmlns:d','DAV:'); + $root->setAttribute('xmlns:d', 'DAV:'); $lockInfo = new DAV\Locks\LockInfo(); $lockInfo->uri = '/foo&bar'; diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ExceptionTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ExceptionTest.php index 6d6bf5668..0eb4f3dd8 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/ExceptionTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/ExceptionTest.php @@ -7,18 +7,18 @@ class ExceptionTest extends \PHPUnit_Framework_TestCase { function testStatus() { $e = new Exception(); - $this->assertEquals(500,$e->getHTTPCode()); + $this->assertEquals(500, $e->getHTTPCode()); } function testExceptionStatuses() { - $c = array( + $c = [ 'Sabre\\DAV\\Exception\\NotAuthenticated' => 401, 'Sabre\\DAV\\Exception\\InsufficientStorage' => 507, - ); + ]; - foreach($c as $class=>$status) { + foreach ($c as $class => $status) { $obj = new $class(); $this->assertEquals($status, $obj->getHTTPCode()); diff --git a/vendor/sabre/dav/tests/Sabre/DAV/FSExt/FileTest.php b/vendor/sabre/dav/tests/Sabre/DAV/FSExt/FileTest.php index 3708594e0..f5d65a44f 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/FSExt/FileTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/FSExt/FileTest.php @@ -2,8 +2,6 @@ namespace Sabre\DAV\FSExt; -use Sabre\DAV; - require_once 'Sabre/TestUtil.php'; class FileTest extends \PHPUnit_Framework_TestCase { @@ -26,12 +24,12 @@ class FileTest extends \PHPUnit_Framework_TestCase { $file = new File($filename); $result = $file->put('New contents'); - $this->assertEquals('New contents',file_get_contents(SABRE_TEMPDIR . '/file.txt')); + $this->assertEquals('New contents', file_get_contents(SABRE_TEMPDIR . '/file.txt')); $this->assertEquals( '"' . sha1( fileinode($filename) . - filesize($filename ) . + filesize($filename) . filemtime($filename) ) . '"', $result @@ -45,13 +43,13 @@ class FileTest extends \PHPUnit_Framework_TestCase { $file->put('0000000'); $file->patch('111', 2, 3); - $this->assertEquals('0001110',file_get_contents(SABRE_TEMPDIR . '/file.txt')); + $this->assertEquals('0001110', file_get_contents(SABRE_TEMPDIR . '/file.txt')); } function testRangeStream() { - $stream = fopen('php://memory','r+'); + $stream = fopen('php://memory', 'r+'); fwrite($stream, "222"); rewind($stream); @@ -59,7 +57,7 @@ class FileTest extends \PHPUnit_Framework_TestCase { $file->put('0000000'); $file->patch($stream, 2, 3); - $this->assertEquals('0002220',file_get_contents(SABRE_TEMPDIR . '/file.txt')); + $this->assertEquals('0002220', file_get_contents(SABRE_TEMPDIR . '/file.txt')); } @@ -67,7 +65,7 @@ class FileTest extends \PHPUnit_Framework_TestCase { function testGet() { $file = new File(SABRE_TEMPDIR . '/file.txt'); - $this->assertEquals('Contents',stream_get_contents($file->get())); + $this->assertEquals('Contents', stream_get_contents($file->get())); } @@ -88,7 +86,7 @@ class FileTest extends \PHPUnit_Framework_TestCase { '"' . sha1( fileinode($filename) . - filesize($filename ) . + filesize($filename) . filemtime($filename) ) . '"', $file->getETag() @@ -105,7 +103,7 @@ class FileTest extends \PHPUnit_Framework_TestCase { function testGetSize() { $file = new File(SABRE_TEMPDIR . '/file.txt'); - $this->assertEquals(8,$file->getSize()); + $this->assertEquals(8, $file->getSize()); } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/FSExt/ServerTest.php b/vendor/sabre/dav/tests/Sabre/DAV/FSExt/ServerTest.php index 63d858de1..20fca490a 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/FSExt/ServerTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/FSExt/ServerTest.php @@ -28,7 +28,7 @@ class ServerTest extends DAV\AbstractServer{ 'Content-Type' => ['application/octet-stream'], 'Content-Length' => [13], 'Last-Modified' => [HTTP\Util::toHTTPDate(new \DateTime('@' . filemtime($filename)))], - 'ETag' => ['"' . sha1(fileinode($filename ) . filesize($filename) . filemtime($filename)) . '"'], + 'ETag' => ['"' . sha1(fileinode($filename) . filesize($filename) . filemtime($filename)) . '"'], ], $this->response->getHeaders() ); @@ -50,12 +50,12 @@ class ServerTest extends DAV\AbstractServer{ 'Content-Type' => ['application/octet-stream'], 'Content-Length' => [13], 'Last-Modified' => [HTTP\Util::toHTTPDate(new \DateTime('@' . filemtime($this->tempDir . '/test.txt')))], - 'ETag' => ['"' . sha1(fileinode($filename ) . filesize($filename) . filemtime($filename)) . '"'], + 'ETag' => ['"' . sha1(fileinode($filename) . filesize($filename) . filemtime($filename)) . '"'], ], $this->response->getHeaders() ); - $this->assertEquals(200,$this->response->status); + $this->assertEquals(200, $this->response->status); $this->assertEquals('', $this->response->body); } @@ -71,12 +71,12 @@ class ServerTest extends DAV\AbstractServer{ $this->assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], 'Content-Length' => ['0'], - 'ETag' => ['"' . sha1(fileinode($filename ) . filesize($filename) . filemtime($filename)) . '"'], + 'ETag' => ['"' . sha1(fileinode($filename) . filesize($filename) . filemtime($filename)) . '"'], ], $this->response->getHeaders()); $this->assertEquals(201, $this->response->status); $this->assertEquals('', $this->response->body); - $this->assertEquals('Testing new file',file_get_contents($filename)); + $this->assertEquals('Testing new file', file_get_contents($filename)); } @@ -89,11 +89,11 @@ class ServerTest extends DAV\AbstractServer{ $this->assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - ],$this->response->getHeaders()); + 'Content-Type' => ['application/xml; charset=utf-8'], + ], $this->response->getHeaders()); $this->assertEquals(412, $this->response->status); - $this->assertNotEquals('Testing new file',file_get_contents($this->tempDir . '/test.txt')); + $this->assertNotEquals('Testing new file', file_get_contents($this->tempDir . '/test.txt')); } @@ -105,8 +105,8 @@ class ServerTest extends DAV\AbstractServer{ $this->assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Length' => ['0'], - ],$this->response->getHeaders()); + 'Content-Length' => ['0'], + ], $this->response->getHeaders()); $this->assertEquals(201, $this->response->status); $this->assertEquals('', $this->response->body); @@ -125,7 +125,7 @@ class ServerTest extends DAV\AbstractServer{ $this->assertEquals(204, $this->response->status); $this->assertEquals('', $this->response->body); - $this->assertEquals('Testing updated file',file_get_contents($this->tempDir . '/test.txt')); + $this->assertEquals('Testing updated file', file_get_contents($this->tempDir . '/test.txt')); } @@ -137,8 +137,8 @@ class ServerTest extends DAV\AbstractServer{ $this->assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Length' => ['0'], - ],$this->response->getHeaders()); + 'Content-Length' => ['0'], + ], $this->response->getHeaders()); $this->assertEquals(204, $this->response->status); $this->assertEquals('', $this->response->body); @@ -148,8 +148,8 @@ class ServerTest extends DAV\AbstractServer{ function testDeleteDirectory() { - mkdir($this->tempDir.'/testcol'); - file_put_contents($this->tempDir.'/testcol/test.txt','Hi! I\'m a file with a short lifespan'); + mkdir($this->tempDir . '/testcol'); + file_put_contents($this->tempDir . '/testcol/test.txt', 'Hi! I\'m a file with a short lifespan'); $request = new HTTP\Request('DELETE', '/testcol'); $this->server->httpRequest = ($request); @@ -157,8 +157,8 @@ class ServerTest extends DAV\AbstractServer{ $this->assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Length' => ['0'], - ],$this->response->getHeaders()); + 'Content-Length' => ['0'], + ], $this->response->getHeaders()); $this->assertEquals(204, $this->response->status); $this->assertEquals('', $this->response->body); $this->assertFalse(file_exists($this->tempDir . '/testcol')); @@ -172,12 +172,12 @@ class ServerTest extends DAV\AbstractServer{ $this->server->exec(); $this->assertEquals([ - 'DAV' => ['1, 3, extended-mkcol'], - 'MS-Author-Via' => ['DAV'], - 'Allow' => ['OPTIONS, GET, HEAD, DELETE, PROPFIND, PUT, PROPPATCH, COPY, MOVE, REPORT'], - 'Accept-Ranges' => ['bytes'], - 'Content-Length' => ['0'], - 'X-Sabre-Version'=> [DAV\Version::VERSION], + 'DAV' => ['1, 3, extended-mkcol'], + 'MS-Author-Via' => ['DAV'], + 'Allow' => ['OPTIONS, GET, HEAD, DELETE, PROPFIND, PUT, PROPPATCH, COPY, MOVE, REPORT'], + 'Accept-Ranges' => ['bytes'], + 'Content-Length' => ['0'], + 'X-Sabre-Version' => [DAV\Version::VERSION], ], $this->response->getHeaders()); $this->assertEquals(200, $this->response->status); @@ -187,7 +187,7 @@ class ServerTest extends DAV\AbstractServer{ function testMove() { - mkdir($this->tempDir.'/testcol'); + mkdir($this->tempDir . '/testcol'); $request = new HTTP\Request('MOVE', '/test.txt', ['Destination' => '/testcol/test2.txt']); $this->server->httpRequest = ($request); @@ -197,9 +197,9 @@ class ServerTest extends DAV\AbstractServer{ $this->assertEquals('', $this->response->body); $this->assertEquals([ - 'Content-Length' => ['0'], - 'X-Sabre-Version'=> [DAV\Version::VERSION], - ],$this->response->getHeaders()); + 'Content-Length' => ['0'], + 'X-Sabre-Version' => [DAV\Version::VERSION], + ], $this->response->getHeaders()); $this->assertTrue( is_file($this->tempDir . '/testcol/test2.txt') @@ -217,8 +217,8 @@ class ServerTest extends DAV\AbstractServer{ */ function testMoveOtherObject() { - mkdir($this->tempDir.'/tree1'); - mkdir($this->tempDir.'/tree2'); + mkdir($this->tempDir . '/tree1'); + mkdir($this->tempDir . '/tree2'); $tree = new DAV\Tree(new DAV\SimpleCollection('root', [ new DAV\FS\Directory($this->tempDir . '/tree1'), @@ -234,9 +234,9 @@ class ServerTest extends DAV\AbstractServer{ $this->assertEquals('', $this->response->body); $this->assertEquals([ - 'Content-Length' => ['0'], - 'X-Sabre-Version'=> [DAV\Version::VERSION], - ],$this->response->getHeaders()); + 'Content-Length' => ['0'], + 'X-Sabre-Version' => [DAV\Version::VERSION], + ], $this->response->getHeaders()); $this->assertTrue( is_dir($this->tempDir . '/tree2/tree1') diff --git a/vendor/sabre/dav/tests/Sabre/DAV/HttpDeleteTest.php b/vendor/sabre/dav/tests/Sabre/DAV/HttpDeleteTest.php index 6c10afa9f..bd1b33150 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/HttpDeleteTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/HttpDeleteTest.php @@ -19,12 +19,12 @@ class HttpDeleteTest extends DAVServerTest { * * @return void */ - public function setUpTree() { + function setUpTree() { $this->tree = new Mock\Collection('root', [ 'file1' => 'foo', - 'dir' => [ - 'subfile' => 'bar', + 'dir' => [ + 'subfile' => 'bar', 'subfile2' => 'baz', ], ]); @@ -34,7 +34,7 @@ class HttpDeleteTest extends DAVServerTest { /** * A successful DELETE */ - public function testDelete() { + function testDelete() { $request = new HTTP\Request('DELETE', '/file1'); @@ -49,7 +49,7 @@ class HttpDeleteTest extends DAVServerTest { $this->assertEquals( [ 'X-Sabre-Version' => [Version::VERSION], - 'Content-Length' => ['0'], + 'Content-Length' => ['0'], ], $response->getHeaders() ); @@ -59,7 +59,7 @@ class HttpDeleteTest extends DAVServerTest { /** * Deleting a Directory */ - public function testDeleteDirectory() { + function testDeleteDirectory() { $request = new HTTP\Request('DELETE', '/dir'); @@ -74,7 +74,7 @@ class HttpDeleteTest extends DAVServerTest { $this->assertEquals( [ 'X-Sabre-Version' => [Version::VERSION], - 'Content-Length' => ['0'], + 'Content-Length' => ['0'], ], $response->getHeaders() ); @@ -84,7 +84,7 @@ class HttpDeleteTest extends DAVServerTest { /** * DELETE on a node that does not exist */ - public function testDeleteNotFound() { + function testDeleteNotFound() { $request = new HTTP\Request('DELETE', '/file2'); $response = $this->request($request); @@ -100,7 +100,7 @@ class HttpDeleteTest extends DAVServerTest { /** * DELETE with preconditions */ - public function testDeletePreconditions() { + function testDeletePreconditions() { $request = new HTTP\Request('DELETE', '/file1', [ 'If-Match' => '"' . md5('foo') . '"', @@ -119,7 +119,7 @@ class HttpDeleteTest extends DAVServerTest { /** * DELETE with incorrect preconditions */ - public function testDeletePreconditionsFailed() { + function testDeletePreconditionsFailed() { $request = new HTTP\Request('DELETE', '/file1', [ 'If-Match' => '"' . md5('bar') . '"', diff --git a/vendor/sabre/dav/tests/Sabre/DAV/HttpPutTest.php b/vendor/sabre/dav/tests/Sabre/DAV/HttpPutTest.php index eddaf3f22..86480b1c2 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/HttpPutTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/HttpPutTest.php @@ -46,8 +46,8 @@ class HttpPutTest extends DAVServerTest { $this->assertEquals( [ 'X-Sabre-Version' => [Version::VERSION], - 'Content-Length' => ['0'], - 'ETag' => ['"' . md5('hello') . '"'] + 'Content-Length' => ['0'], + 'ETag' => ['"' . md5('hello') . '"'] ], $response->getHeaders() ); @@ -75,8 +75,8 @@ class HttpPutTest extends DAVServerTest { $this->assertEquals( [ 'X-Sabre-Version' => [Version::VERSION], - 'Content-Length' => ['0'], - 'ETag' => ['"' . md5('bar') . '"'] + 'Content-Length' => ['0'], + 'ETag' => ['"' . md5('bar') . '"'] ], $response->getHeaders() ); @@ -109,8 +109,8 @@ class HttpPutTest extends DAVServerTest { $this->assertEquals( [ 'X-Sabre-Version' => [Version::VERSION], - 'Content-Length' => ['0'], - 'ETag' => ['"' . md5('hello') . '"'] + 'Content-Length' => ['0'], + 'ETag' => ['"' . md5('hello') . '"'] ], $response->getHeaders() ); @@ -143,8 +143,8 @@ class HttpPutTest extends DAVServerTest { $this->assertEquals( [ 'X-Sabre-Version' => [Version::VERSION], - 'Content-Length' => ['0'], - 'ETag' => ['"' . md5('hello') . '"'], + 'Content-Length' => ['0'], + 'ETag' => ['"' . md5('hello') . '"'], ], $response->getHeaders() ); @@ -196,8 +196,8 @@ class HttpPutTest extends DAVServerTest { $this->assertEquals( [ 'X-Sabre-Version' => [Version::VERSION], - 'Content-Length' => ['0'], - 'ETag' => ['"' . md5('hello') . '"'] + 'Content-Length' => ['0'], + 'ETag' => ['"' . md5('hello') . '"'] ], $response->getHeaders() ); @@ -291,8 +291,8 @@ class HttpPutTest extends DAVServerTest { $this->assertEquals( [ 'X-Sabre-Version' => [Version::VERSION], - 'Content-Length' => ['0'], - 'ETag' => ['"' . md5('hello') . '"'], + 'Content-Length' => ['0'], + 'ETag' => ['"' . md5('hello') . '"'], ], $response->getHeaders() ); @@ -334,7 +334,7 @@ class HttpPutTest extends DAVServerTest { $request = new HTTP\Request('PUT', '/file2', [], 'hello'); $response = $this->request($request); - $this->assertEquals(418, $response->getStatus(), 'Incorrect status code received. Full response body: ' .$response->getBodyAsString()); + $this->assertEquals(418, $response->getStatus(), 'Incorrect status code received. Full response body: ' . $response->getBodyAsString()); $this->assertFalse( $this->server->tree->nodeExists('file2') diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Issue33Test.php b/vendor/sabre/dav/tests/Sabre/DAV/Issue33Test.php index 4ccb42fbb..edd09e634 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Issue33Test.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Issue33Test.php @@ -17,16 +17,16 @@ class Issue33Test extends \PHPUnit_Framework_TestCase { function testCopyMoveInfo() { $bar = new SimpleCollection('bar'); - $root = new SimpleCollection('webdav',array($bar)); + $root = new SimpleCollection('webdav', [$bar]); $server = new Server($root); $server->setBaseUri('/webdav/'); - $serverVars = array( - 'REQUEST_URI' => '/webdav/bar', + $serverVars = [ + 'REQUEST_URI' => '/webdav/bar', 'HTTP_DESTINATION' => 'http://dev2.tribalos.com/webdav/%C3%A0fo%C3%B3', - 'HTTP_OVERWRITE' => 'F', - ); + 'HTTP_OVERWRITE' => 'F', + ]; $request = HTTP\Sapi::createFromServerArray($serverVars); @@ -48,19 +48,19 @@ class Issue33Test extends \PHPUnit_Framework_TestCase { $dir->createDirectory('bar'); $tree = new Tree($dir); - $tree->move('bar',urldecode('%C3%A0fo%C3%B3')); + $tree->move('bar', urldecode('%C3%A0fo%C3%B3')); $node = $tree->getNodeForPath(urldecode('%C3%A0fo%C3%B3')); - $this->assertEquals(urldecode('%C3%A0fo%C3%B3'),$node->getName()); + $this->assertEquals(urldecode('%C3%A0fo%C3%B3'), $node->getName()); } function testDirName() { $dirname1 = 'bar'; - $dirname2 = urlencode('%C3%A0fo%C3%B3');; + $dirname2 = urlencode('%C3%A0fo%C3%B3'); - $this->assertTrue(dirname($dirname1)==dirname($dirname2)); + $this->assertTrue(dirname($dirname1) == dirname($dirname2)); } @@ -71,12 +71,12 @@ class Issue33Test extends \PHPUnit_Framework_TestCase { function testEverything() { // Request object - $serverVars = array( - 'REQUEST_METHOD' => 'MOVE', - 'REQUEST_URI' => '/webdav/bar', + $serverVars = [ + 'REQUEST_METHOD' => 'MOVE', + 'REQUEST_URI' => '/webdav/bar', 'HTTP_DESTINATION' => 'http://dev2.tribalos.com/webdav/%C3%A0fo%C3%B3', - 'HTTP_OVERWRITE' => 'F', - ); + 'HTTP_OVERWRITE' => 'F', + ]; $request = HTTP\Sapi::createFromServerArray($serverVars); $request->setBody(''); diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/AbstractTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/AbstractTest.php index f39e9a036..bbde69097 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/AbstractTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/AbstractTest.php @@ -31,15 +31,15 @@ abstract class AbstractTest extends \PHPUnit_Framework_TestCase { $lock->timeout = 60; $lock->created = time(); $lock->token = 'MY-UNIQUE-TOKEN'; - $lock->uri ='someuri'; + $lock->uri = 'someuri'; $this->assertTrue($backend->lock('someuri', $lock)); $locks = $backend->getLocks('someuri', false); - $this->assertEquals(1,count($locks)); - $this->assertEquals('Sinterklaas',$locks[0]->owner); - $this->assertEquals('someuri',$locks[0]->uri); + $this->assertEquals(1, count($locks)); + $this->assertEquals('Sinterklaas', $locks[0]->owner); + $this->assertEquals('someuri', $locks[0]->uri); } @@ -61,9 +61,9 @@ abstract class AbstractTest extends \PHPUnit_Framework_TestCase { $locks = $backend->getLocks('someuri/child', false); - $this->assertEquals(1,count($locks)); - $this->assertEquals('Sinterklaas',$locks[0]->owner); - $this->assertEquals('someuri',$locks[0]->uri); + $this->assertEquals(1, count($locks)); + $this->assertEquals('Sinterklaas', $locks[0]->owner); + $this->assertEquals('someuri', $locks[0]->uri); } @@ -86,7 +86,7 @@ abstract class AbstractTest extends \PHPUnit_Framework_TestCase { $locks = $backend->getLocks('someuri/child', false); - $this->assertEquals(0,count($locks)); + $this->assertEquals(0, count($locks)); } @@ -104,13 +104,13 @@ abstract class AbstractTest extends \PHPUnit_Framework_TestCase { $this->assertTrue($backend->lock('someuri/child', $lock)); $locks = $backend->getLocks('someuri/child', false); - $this->assertEquals(1,count($locks)); + $this->assertEquals(1, count($locks)); $locks = $backend->getLocks('someuri', false); - $this->assertEquals(0,count($locks)); + $this->assertEquals(0, count($locks)); $locks = $backend->getLocks('someuri', true); - $this->assertEquals(1,count($locks)); + $this->assertEquals(1, count($locks)); } @@ -135,10 +135,10 @@ abstract class AbstractTest extends \PHPUnit_Framework_TestCase { $locks = $backend->getLocks('someuri', false); - $this->assertEquals(1,count($locks)); + $this->assertEquals(1, count($locks)); - $this->assertEquals('Santa Clause',$locks[0]->owner); - $this->assertEquals('someuri',$locks[0]->uri); + $this->assertEquals('Santa Clause', $locks[0]->owner); + $this->assertEquals('someuri', $locks[0]->uri); } @@ -158,12 +158,12 @@ abstract class AbstractTest extends \PHPUnit_Framework_TestCase { $this->assertTrue($backend->lock('someuri', $lock)); $locks = $backend->getLocks('someuri', false); - $this->assertEquals(1,count($locks)); + $this->assertEquals(1, count($locks)); - $this->assertTrue($backend->unlock('someuri',$lock)); + $this->assertTrue($backend->unlock('someuri', $lock)); $locks = $backend->getLocks('someuri', false); - $this->assertEquals(0,count($locks)); + $this->assertEquals(0, count($locks)); } @@ -183,13 +183,13 @@ abstract class AbstractTest extends \PHPUnit_Framework_TestCase { $this->assertTrue($backend->lock('someuri', $lock)); $locks = $backend->getLocks('someuri', false); - $this->assertEquals(1,count($locks)); + $this->assertEquals(1, count($locks)); $lock->token = 'SOME-OTHER-TOKEN'; - $this->assertFalse($backend->unlock('someuri',$lock)); + $this->assertFalse($backend->unlock('someuri', $lock)); $locks = $backend->getLocks('someuri', false); - $this->assertEquals(1,count($locks)); + $this->assertEquals(1, count($locks)); } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/PDOMySQLTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/PDOMySQLTest.php index b6f06224c..0ba02fc8b 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/PDOMySQLTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/PDOMySQLTest.php @@ -2,31 +2,8 @@ namespace Sabre\DAV\Locks\Backend; -require_once 'Sabre/TestUtil.php'; +class PDOMySQLTest extends PDOTest { -class PDOMySQLTest extends AbstractTest { - - function getBackend() { - - if (!SABRE_HASMYSQL) $this->markTestSkipped('MySQL driver is not available, or it was not properly configured'); - $pdo = \Sabre\TestUtil::getMySQLDB(); - if (!$pdo) $this->markTestSkipped('Could not connect to MySQL database'); - $pdo->query('DROP TABLE IF EXISTS locks;'); - $pdo->query(" -CREATE TABLE locks ( - id INTEGER UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, - owner VARCHAR(100), - timeout INTEGER UNSIGNED, - created INTEGER, - token VARCHAR(100), - scope TINYINT, - depth TINYINT, - uri text -);"); - - $backend = new PDO($pdo); - return $backend; - - } + public $driver = 'mysql'; } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/PDOTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/PDOTest.php index d6336c7b2..a27eae93c 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/PDOTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Locks/Backend/PDOTest.php @@ -2,27 +2,18 @@ namespace Sabre\DAV\Locks\Backend; -require_once 'Sabre/TestUtil.php'; -require_once 'Sabre/DAV/Locks/Backend/AbstractTest.php'; +abstract class PDOTest extends AbstractTest { -class PDOTest extends AbstractTest { + use \Sabre\DAV\DbTestHelperTrait; function getBackend() { - if (!SABRE_HASSQLITE) $this->markTestSkipped('SQLite driver is not available'); - \Sabre\TestUtil::clearTempDir(); - mkdir(SABRE_TEMPDIR . '/pdolocks'); - $pdo = new \PDO('sqlite:' . SABRE_TEMPDIR . '/pdolocks/db.sqlite'); - $pdo->setAttribute(\PDO::ATTR_ERRMODE,\PDO::ERRMODE_EXCEPTION); - $pdo->query('CREATE TABLE locks ( id integer primary key asc, owner text, timeout text, created integer, token text, scope integer, depth integer, uri text)'); - $backend = new PDO($pdo); - return $backend; + $this->dropTables('locks'); + $this->createSchema('locks'); - } - - function tearDown() { + $pdo = $this->getPDO(); - \Sabre\TestUtil::clearTempDir(); + return new PDO($pdo); } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Locks/MSWordTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Locks/MSWordTest.php index 23f283796..f08f19da5 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Locks/MSWordTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Locks/MSWordTest.php @@ -62,12 +62,12 @@ class MSWordTest extends \PHPUnit_Framework_TestCase { function getLockRequest() { - $request = HTTP\Sapi::createFromServerArray(array( + $request = HTTP\Sapi::createFromServerArray([ 'REQUEST_METHOD' => 'LOCK', 'HTTP_CONTENT_TYPE' => 'application/xml', 'HTTP_TIMEOUT' => 'Second-3600', 'REQUEST_URI' => '/Nouveau%20Microsoft%20Office%20Excel%20Worksheet.xlsx', - )); + ]); $request->setBody('<D:lockinfo xmlns:D="DAV:"> <D:lockscope> @@ -86,12 +86,12 @@ class MSWordTest extends \PHPUnit_Framework_TestCase { } function getLockRequest2() { - $request = HTTP\Sapi::createFromServerArray(array( + $request = HTTP\Sapi::createFromServerArray([ 'REQUEST_METHOD' => 'LOCK', 'HTTP_CONTENT_TYPE' => 'application/xml', 'HTTP_TIMEOUT' => 'Second-3600', 'REQUEST_URI' => '/~$Nouveau%20Microsoft%20Office%20Excel%20Worksheet.xlsx', - )); + ]); $request->setBody('<D:lockinfo xmlns:D="DAV:"> <D:lockscope> @@ -111,11 +111,11 @@ class MSWordTest extends \PHPUnit_Framework_TestCase { function getPutRequest($lockToken) { - $request = HTTP\Sapi::createFromServerArray(array( + $request = HTTP\Sapi::createFromServerArray([ 'REQUEST_METHOD' => 'PUT', 'REQUEST_URI' => '/Nouveau%20Microsoft%20Office%20Excel%20Worksheet.xlsx', - 'HTTP_IF' => 'If: ('.$lockToken.')', - )); + 'HTTP_IF' => 'If: (' . $lockToken . ')', + ]); $request->setBody('FAKE BODY'); return $request; diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Locks/PluginTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Locks/PluginTest.php index ef0e473ae..6511d4e7d 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Locks/PluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Locks/PluginTest.php @@ -35,13 +35,13 @@ class PluginTest extends DAV\AbstractServer { function testGetFeatures() { - $this->assertEquals(array(2),$this->locksPlugin->getFeatures()); + $this->assertEquals([2], $this->locksPlugin->getFeatures()); } function testGetHTTPMethods() { - $this->assertEquals(array('LOCK','UNLOCK'),$this->locksPlugin->getHTTPMethods('')); + $this->assertEquals(['LOCK', 'UNLOCK'], $this->locksPlugin->getHTTPMethods('')); } @@ -51,10 +51,10 @@ class PluginTest extends DAV\AbstractServer { $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals(array( + $this->assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - ), + 'Content-Type' => ['application/xml; charset=utf-8'], + ], $this->response->getHeaders() ); @@ -77,16 +77,16 @@ class PluginTest extends DAV\AbstractServer { $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type')); - $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/',$this->response->getHeader('Lock-Token'))===1,'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')'); + $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); + $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')) === 1, 'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')'); - $this->assertEquals(200, $this->response->status,'Got an incorrect status back. Response body: ' . $this->response->body); + $this->assertEquals(200, $this->response->status, 'Got an incorrect status back. Response body: ' . $this->response->body); - $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/","xmlns\\1=\"urn:DAV\"",$this->response->body); + $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", "xmlns\\1=\"urn:DAV\"", $this->response->body); $xml = simplexml_load_string($body); - $xml->registerXPathNamespace('d','urn:DAV'); + $xml->registerXPathNamespace('d', 'urn:DAV'); - $elements = array( + $elements = [ '/d:prop', '/d:prop/d:lockdiscovery', '/d:prop/d:lockdiscovery/d:activelock', @@ -101,18 +101,18 @@ class PluginTest extends DAV\AbstractServer { '/d:prop/d:lockdiscovery/d:activelock/d:timeout', '/d:prop/d:lockdiscovery/d:activelock/d:locktoken', '/d:prop/d:lockdiscovery/d:activelock/d:locktoken/d:href', - ); + ]; - foreach($elements as $elem) { + foreach ($elements as $elem) { $data = $xml->xpath($elem); - $this->assertEquals(1,count($data),'We expected 1 match for the xpath expression "' . $elem . '". ' . count($data) . ' were found. Full response body: ' . $this->response->body); + $this->assertEquals(1, count($data), 'We expected 1 match for the xpath expression "' . $elem . '". ' . count($data) . ' were found. Full response body: ' . $this->response->body); } $depth = $xml->xpath('/d:prop/d:lockdiscovery/d:activelock/d:depth'); - $this->assertEquals('infinity',(string)$depth[0]); + $this->assertEquals('infinity', (string)$depth[0]); $token = $xml->xpath('/d:prop/d:lockdiscovery/d:activelock/d:locktoken/d:href'); - $this->assertEquals($this->response->getHeader('Lock-Token'),'<' . (string)$token[0] . '>','Token in response body didn\'t match token in response header.'); + $this->assertEquals($this->response->getHeader('Lock-Token'), '<' . (string)$token[0] . '>', 'Token in response body didn\'t match token in response header.'); } @@ -139,7 +139,7 @@ class PluginTest extends DAV\AbstractServer { $this->server->exec(); - $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type')); + $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); $this->assertEquals(423, $this->response->status, 'Full response: ' . $this->response->body); @@ -174,9 +174,9 @@ class PluginTest extends DAV\AbstractServer { $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type')); + $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); - $this->assertEquals(200, $this->response->status,'We received an incorrect status code. Full response body: ' . $this->response->getBody()); + $this->assertEquals(200, $this->response->status, 'We received an incorrect status code. Full response body: ' . $this->response->getBody()); } @@ -209,9 +209,9 @@ class PluginTest extends DAV\AbstractServer { $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type')); + $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); - $this->assertEquals(423, $this->response->getStatus(),'We received an incorrect status code. Full response body: ' . $this->response->getBody()); + $this->assertEquals(423, $this->response->getStatus(), 'We received an incorrect status code. Full response body: ' . $this->response->getBody()); } @@ -233,8 +233,8 @@ class PluginTest extends DAV\AbstractServer { $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type')); - $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/',$this->response->getHeader('Lock-Token'))===1,'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')'); + $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); + $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')) === 1, 'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')'); $this->assertEquals(201, $this->response->status); @@ -251,7 +251,7 @@ class PluginTest extends DAV\AbstractServer { $this->assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], + 'Content-Type' => ['application/xml; charset=utf-8'], ], $this->response->getHeaders() ); @@ -271,7 +271,7 @@ class PluginTest extends DAV\AbstractServer { $this->assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], + 'Content-Type' => ['application/xml; charset=utf-8'], ], $this->response->getHeaders() ); @@ -298,8 +298,8 @@ class PluginTest extends DAV\AbstractServer { $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type')); - $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/',$this->response->getHeader('Lock-Token'))===1,'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')'); + $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); + $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')) === 1, 'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')'); $this->assertEquals(200, $this->response->status); @@ -308,8 +308,8 @@ class PluginTest extends DAV\AbstractServer { $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type')); - $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/',$this->response->getHeader('Lock-Token'))===1,'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')'); + $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); + $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')) === 1, 'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')'); $this->assertEquals(423, $this->response->status); @@ -340,10 +340,10 @@ class PluginTest extends DAV\AbstractServer { $this->server->httpResponse = new HTTP\ResponseMock(); $this->server->invokeMethod($request, $this->server->httpResponse); - $this->assertEquals(204,$this->server->httpResponse->status,'Got an incorrect status code. Full response body: ' . $this->response->body); + $this->assertEquals(204, $this->server->httpResponse->status, 'Got an incorrect status code. Full response body: ' . $this->response->body); $this->assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Length' => ['0'], + 'Content-Length' => ['0'], ], $this->server->httpResponse->getHeaders() ); @@ -372,17 +372,17 @@ class PluginTest extends DAV\AbstractServer { $lockToken = $this->server->httpResponse->getHeader('Lock-Token'); // See Issue 123 - $lockToken = trim($lockToken,'<>'); + $lockToken = trim($lockToken, '<>'); $request = new HTTP\Request('UNLOCK', '/test.txt', ['Lock-Token' => $lockToken]); $this->server->httpRequest = $request; $this->server->httpResponse = new HTTP\ResponseMock(); $this->server->invokeMethod($request, $this->server->httpResponse); - $this->assertEquals(204, $this->server->httpResponse->status,'Got an incorrect status code. Full response body: ' . $this->response->body); + $this->assertEquals(204, $this->server->httpResponse->status, 'Got an incorrect status code. Full response body: ' . $this->response->body); $this->assertEquals([ 'X-Sabre-Version' => [DAV\Version::VERSION], - 'Content-Length' => ['0'], + 'Content-Length' => ['0'], ], $this->server->httpResponse->getHeaders() ); @@ -396,7 +396,7 @@ class PluginTest extends DAV\AbstractServer { function testLockRetainOwner() { $request = HTTP\Sapi::createFromServerArray([ - 'REQUEST_URI' => '/test.txt', + 'REQUEST_URI' => '/test.txt', 'REQUEST_METHOD' => 'LOCK', ]); $this->server->httpRequest = $request; @@ -412,8 +412,8 @@ class PluginTest extends DAV\AbstractServer { $lockToken = $this->server->httpResponse->getHeader('Lock-Token'); $locks = $this->locksPlugin->getLocks('test.txt'); - $this->assertEquals(1,count($locks)); - $this->assertEquals('Evert',$locks[0]->owner); + $this->assertEquals(1, count($locks)); + $this->assertEquals('Evert', $locks[0]->owner); } @@ -423,10 +423,10 @@ class PluginTest extends DAV\AbstractServer { */ function testLockPutBadToken() { - $serverVars = array( + $serverVars = [ 'REQUEST_URI' => '/test.txt', 'REQUEST_METHOD' => 'LOCK', - ); + ]; $request = HTTP\Sapi::createFromServerArray($serverVars); $request->setBody('<?xml version="1.0"?> @@ -441,24 +441,24 @@ class PluginTest extends DAV\AbstractServer { $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type')); - $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/',$this->response->getHeader('Lock-Token'))===1,'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')'); + $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); + $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')) === 1, 'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')'); $this->assertEquals(200, $this->response->status); - $serverVars = array( + $serverVars = [ 'REQUEST_URI' => '/test.txt', 'REQUEST_METHOD' => 'PUT', - 'HTTP_IF' => '(<opaquelocktoken:token1>)', - ); + 'HTTP_IF' => '(<opaquelocktoken:token1>)', + ]; $request = HTTP\Sapi::createFromServerArray($serverVars); $request->setBody('newbody'); $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type')); - $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/',$this->response->getHeader('Lock-Token'))===1,'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')'); + $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); + $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')) === 1, 'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')'); // $this->assertEquals('412 Precondition failed',$this->response->status); $this->assertEquals(423, $this->response->status); @@ -470,10 +470,10 @@ class PluginTest extends DAV\AbstractServer { */ function testLockDeleteParent() { - $serverVars = array( + $serverVars = [ 'REQUEST_URI' => '/dir/child.txt', 'REQUEST_METHOD' => 'LOCK', - ); + ]; $request = HTTP\Sapi::createFromServerArray($serverVars); $request->setBody('<?xml version="1.0"?> @@ -488,22 +488,22 @@ class PluginTest extends DAV\AbstractServer { $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type')); - $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/',$this->response->getHeader('Lock-Token'))===1,'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')'); + $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); + $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')) === 1, 'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')'); $this->assertEquals(200, $this->response->status); - $serverVars = array( + $serverVars = [ 'REQUEST_URI' => '/dir', 'REQUEST_METHOD' => 'DELETE', - ); + ]; $request = HTTP\Sapi::createFromServerArray($serverVars); $this->server->httpRequest = $request; $this->server->exec(); $this->assertEquals(423, $this->response->status); - $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type')); + $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); } /** @@ -511,10 +511,10 @@ class PluginTest extends DAV\AbstractServer { */ function testLockDeleteSucceed() { - $serverVars = array( + $serverVars = [ 'REQUEST_URI' => '/dir/child.txt', 'REQUEST_METHOD' => 'LOCK', - ); + ]; $request = HTTP\Sapi::createFromServerArray($serverVars); $request->setBody('<?xml version="1.0"?> @@ -529,23 +529,23 @@ class PluginTest extends DAV\AbstractServer { $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type')); - $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/',$this->response->getHeader('Lock-Token'))===1,'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')'); + $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); + $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')) === 1, 'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')'); $this->assertEquals(200, $this->response->status); - $serverVars = array( + $serverVars = [ 'REQUEST_URI' => '/dir/child.txt', 'REQUEST_METHOD' => 'DELETE', - 'HTTP_IF' => '(' . $this->response->getHeader('Lock-Token') . ')', - ); + 'HTTP_IF' => '(' . $this->response->getHeader('Lock-Token') . ')', + ]; $request = HTTP\Sapi::createFromServerArray($serverVars); $this->server->httpRequest = $request; $this->server->exec(); $this->assertEquals(204, $this->response->status); - $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type')); + $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); } @@ -554,10 +554,10 @@ class PluginTest extends DAV\AbstractServer { */ function testLockCopyLockSource() { - $serverVars = array( + $serverVars = [ 'REQUEST_URI' => '/dir/child.txt', 'REQUEST_METHOD' => 'LOCK', - ); + ]; $request = HTTP\Sapi::createFromServerArray($serverVars); $request->setBody('<?xml version="1.0"?> @@ -572,23 +572,23 @@ class PluginTest extends DAV\AbstractServer { $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type')); - $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/',$this->response->getHeader('Lock-Token'))===1,'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')'); + $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); + $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')) === 1, 'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')'); $this->assertEquals(200, $this->response->status); - $serverVars = array( - 'REQUEST_URI' => '/dir/child.txt', - 'REQUEST_METHOD' => 'COPY', + $serverVars = [ + 'REQUEST_URI' => '/dir/child.txt', + 'REQUEST_METHOD' => 'COPY', 'HTTP_DESTINATION' => '/dir/child2.txt', - ); + ]; $request = HTTP\Sapi::createFromServerArray($serverVars); $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals(201, $this->response->status,'Copy must succeed if only the source is locked, but not the destination'); - $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type')); + $this->assertEquals(201, $this->response->status, 'Copy must succeed if only the source is locked, but not the destination'); + $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); } /** @@ -596,10 +596,10 @@ class PluginTest extends DAV\AbstractServer { */ function testLockCopyLockDestination() { - $serverVars = array( + $serverVars = [ 'REQUEST_URI' => '/dir/child2.txt', 'REQUEST_METHOD' => 'LOCK', - ); + ]; $request = HTTP\Sapi::createFromServerArray($serverVars); $request->setBody('<?xml version="1.0"?> @@ -614,23 +614,23 @@ class PluginTest extends DAV\AbstractServer { $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type')); - $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/',$this->response->getHeader('Lock-Token'))===1,'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')'); + $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); + $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')) === 1, 'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')'); $this->assertEquals(201, $this->response->status); - $serverVars = array( - 'REQUEST_URI' => '/dir/child.txt', - 'REQUEST_METHOD' => 'COPY', + $serverVars = [ + 'REQUEST_URI' => '/dir/child.txt', + 'REQUEST_METHOD' => 'COPY', 'HTTP_DESTINATION' => '/dir/child2.txt', - ); + ]; $request = HTTP\Sapi::createFromServerArray($serverVars); $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals(423, $this->response->status,'Copy must succeed if only the source is locked, but not the destination'); - $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type')); + $this->assertEquals(423, $this->response->status, 'Copy must succeed if only the source is locked, but not the destination'); + $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); } @@ -639,10 +639,10 @@ class PluginTest extends DAV\AbstractServer { */ function testLockMoveLockSourceLocked() { - $serverVars = array( + $serverVars = [ 'REQUEST_URI' => '/dir/child.txt', 'REQUEST_METHOD' => 'LOCK', - ); + ]; $request = HTTP\Sapi::createFromServerArray($serverVars); $request->setBody('<?xml version="1.0"?> @@ -657,23 +657,23 @@ class PluginTest extends DAV\AbstractServer { $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type')); - $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/',$this->response->getHeader('Lock-Token'))===1,'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')'); + $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); + $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')) === 1, 'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')'); $this->assertEquals(200, $this->response->status); - $serverVars = array( - 'REQUEST_URI' => '/dir/child.txt', - 'REQUEST_METHOD' => 'MOVE', + $serverVars = [ + 'REQUEST_URI' => '/dir/child.txt', + 'REQUEST_METHOD' => 'MOVE', 'HTTP_DESTINATION' => '/dir/child2.txt', - ); + ]; $request = HTTP\Sapi::createFromServerArray($serverVars); $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals(423, $this->response->status,'Copy must succeed if only the source is locked, but not the destination'); - $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type')); + $this->assertEquals(423, $this->response->status, 'Copy must succeed if only the source is locked, but not the destination'); + $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); } @@ -682,10 +682,10 @@ class PluginTest extends DAV\AbstractServer { */ function testLockMoveLockSourceSucceed() { - $serverVars = array( + $serverVars = [ 'REQUEST_URI' => '/dir/child.txt', 'REQUEST_METHOD' => 'LOCK', - ); + ]; $request = HTTP\Sapi::createFromServerArray($serverVars); $request->setBody('<?xml version="1.0"?> @@ -700,23 +700,23 @@ class PluginTest extends DAV\AbstractServer { $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type')); - $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/',$this->response->getHeader('Lock-Token'))===1,'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')'); + $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); + $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')) === 1, 'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')'); $this->assertEquals(200, $this->response->status); - $serverVars = array( - 'REQUEST_URI' => '/dir/child.txt', - 'REQUEST_METHOD' => 'MOVE', + $serverVars = [ + 'REQUEST_URI' => '/dir/child.txt', + 'REQUEST_METHOD' => 'MOVE', 'HTTP_DESTINATION' => '/dir/child2.txt', - 'HTTP_IF' => '(' . $this->response->getHeader('Lock-Token') . ')', - ); + 'HTTP_IF' => '(' . $this->response->getHeader('Lock-Token') . ')', + ]; $request = HTTP\Sapi::createFromServerArray($serverVars); $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals(201, $this->response->status,'A valid lock-token was provided for the source, so this MOVE operation must succeed. Full response body: ' . $this->response->body); + $this->assertEquals(201, $this->response->status, 'A valid lock-token was provided for the source, so this MOVE operation must succeed. Full response body: ' . $this->response->body); } @@ -725,10 +725,10 @@ class PluginTest extends DAV\AbstractServer { */ function testLockMoveLockDestination() { - $serverVars = array( + $serverVars = [ 'REQUEST_URI' => '/dir/child2.txt', 'REQUEST_METHOD' => 'LOCK', - ); + ]; $request = HTTP\Sapi::createFromServerArray($serverVars); $request->setBody('<?xml version="1.0"?> @@ -743,23 +743,23 @@ class PluginTest extends DAV\AbstractServer { $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type')); - $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/',$this->response->getHeader('Lock-Token'))===1,'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')'); + $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); + $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')) === 1, 'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')'); $this->assertEquals(201, $this->response->status); - $serverVars = array( - 'REQUEST_URI' => '/dir/child.txt', - 'REQUEST_METHOD' => 'MOVE', + $serverVars = [ + 'REQUEST_URI' => '/dir/child.txt', + 'REQUEST_METHOD' => 'MOVE', 'HTTP_DESTINATION' => '/dir/child2.txt', - ); + ]; $request = HTTP\Sapi::createFromServerArray($serverVars); $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals(423, $this->response->status,'Copy must succeed if only the source is locked, but not the destination'); - $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type')); + $this->assertEquals(423, $this->response->status, 'Copy must succeed if only the source is locked, but not the destination'); + $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); } /** @@ -767,11 +767,11 @@ class PluginTest extends DAV\AbstractServer { */ function testLockMoveLockParent() { - $serverVars = array( + $serverVars = [ 'REQUEST_URI' => '/dir', 'REQUEST_METHOD' => 'LOCK', - 'HTTP_DEPTH' => 'infinite', - ); + 'HTTP_DEPTH' => 'infinite', + ]; $request = HTTP\Sapi::createFromServerArray($serverVars); $request->setBody('<?xml version="1.0"?> @@ -786,24 +786,24 @@ class PluginTest extends DAV\AbstractServer { $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type')); - $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/',$this->response->getHeader('Lock-Token'))===1,'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')'); + $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); + $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')) === 1, 'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')'); - $this->assertEquals(200,$this->response->status); + $this->assertEquals(200, $this->response->status); - $serverVars = array( - 'REQUEST_URI' => '/dir/child.txt', - 'REQUEST_METHOD' => 'MOVE', + $serverVars = [ + 'REQUEST_URI' => '/dir/child.txt', + 'REQUEST_METHOD' => 'MOVE', 'HTTP_DESTINATION' => '/dir/child2.txt', - 'HTTP_IF' => '</dir> (' . $this->response->getHeader('Lock-Token') . ')', - ); + 'HTTP_IF' => '</dir> (' . $this->response->getHeader('Lock-Token') . ')', + ]; $request = HTTP\Sapi::createFromServerArray($serverVars); $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals(201, $this->response->status,'We locked the parent of both the source and destination, but the move didn\'t succeed.'); - $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type')); + $this->assertEquals(201, $this->response->status, 'We locked the parent of both the source and destination, but the move didn\'t succeed.'); + $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); } @@ -812,10 +812,10 @@ class PluginTest extends DAV\AbstractServer { */ function testLockPutGoodToken() { - $serverVars = array( + $serverVars = [ 'REQUEST_URI' => '/test.txt', 'REQUEST_METHOD' => 'LOCK', - ); + ]; $request = HTTP\Sapi::createFromServerArray($serverVars); $request->setBody('<?xml version="1.0"?> @@ -830,24 +830,24 @@ class PluginTest extends DAV\AbstractServer { $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type')); - $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/',$this->response->getHeader('Lock-Token'))===1,'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')'); + $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); + $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')) === 1, 'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')'); $this->assertEquals(200, $this->response->status); - $serverVars = array( + $serverVars = [ 'REQUEST_URI' => '/test.txt', 'REQUEST_METHOD' => 'PUT', - 'HTTP_IF' => '('.$this->response->getHeader('Lock-Token').')', - ); + 'HTTP_IF' => '(' . $this->response->getHeader('Lock-Token') . ')', + ]; $request = HTTP\Sapi::createFromServerArray($serverVars); $request->setBody('newbody'); $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type')); - $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/',$this->response->getHeader('Lock-Token'))===1,'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')'); + $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); + $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')) === 1, 'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')'); $this->assertEquals(204, $this->response->status); @@ -871,22 +871,22 @@ class PluginTest extends DAV\AbstractServer { $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type')); - $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/',$this->response->getHeader('Lock-Token'))===1,'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')'); + $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); + $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')) === 1, 'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')'); $this->assertEquals(201, $this->response->getStatus()); $request = new HTTP\Request( 'PUT', '/test.txt', - ['If' => '</unrelated.txt> ('.$this->response->getHeader('Lock-Token').')'] + ['If' => '</unrelated.txt> (' . $this->response->getHeader('Lock-Token') . ')'] ); $request->setBody('newbody'); $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type')); - $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/',$this->response->getHeader('Lock-Token'))===1,'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')'); + $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); + $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')) === 1, 'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')'); $this->assertEquals(204, $this->response->status); @@ -894,11 +894,11 @@ class PluginTest extends DAV\AbstractServer { function testPutWithIncorrectETag() { - $serverVars = array( + $serverVars = [ 'REQUEST_URI' => '/test.txt', 'REQUEST_METHOD' => 'PUT', - 'HTTP_IF' => '(["etag1"])', - ); + 'HTTP_IF' => '(["etag1"])', + ]; $request = HTTP\Sapi::createFromServerArray($serverVars); $request->setBody('newbody'); @@ -920,14 +920,14 @@ class PluginTest extends DAV\AbstractServer { $filename = SABRE_TEMPDIR . '/test.txt'; $etag = sha1( fileinode($filename) . - filesize($filename ) . + filesize($filename) . filemtime($filename) ); - $serverVars = array( + $serverVars = [ 'REQUEST_URI' => '/test.txt', 'REQUEST_METHOD' => 'PUT', - 'HTTP_IF' => '(["'.$etag.'"])', - ); + 'HTTP_IF' => '(["' . $etag . '"])', + ]; $request = HTTP\Sapi::createFromServerArray($serverVars); $request->setBody('newbody'); @@ -939,11 +939,11 @@ class PluginTest extends DAV\AbstractServer { function testDeleteWithETagOnCollection() { - $serverVars = array( + $serverVars = [ 'REQUEST_URI' => '/dir', 'REQUEST_METHOD' => 'DELETE', - 'HTTP_IF' => '(["etag1"])', - ); + 'HTTP_IF' => '(["etag1"])', + ]; $request = HTTP\Sapi::createFromServerArray($serverVars); $this->server->httpRequest = $request; @@ -954,9 +954,9 @@ class PluginTest extends DAV\AbstractServer { function testGetTimeoutHeader() { - $request = HTTP\Sapi::createFromServerArray(array( + $request = HTTP\Sapi::createFromServerArray([ 'HTTP_TIMEOUT' => 'second-100', - )); + ]); $this->server->httpRequest = $request; $this->assertEquals(100, $this->locksPlugin->getTimeoutHeader()); @@ -965,9 +965,9 @@ class PluginTest extends DAV\AbstractServer { function testGetTimeoutHeaderTwoItems() { - $request = HTTP\Sapi::createFromServerArray(array( + $request = HTTP\Sapi::createFromServerArray([ 'HTTP_TIMEOUT' => 'second-5, infinite', - )); + ]); $this->server->httpRequest = $request; $this->assertEquals(5, $this->locksPlugin->getTimeoutHeader()); @@ -976,9 +976,9 @@ class PluginTest extends DAV\AbstractServer { function testGetTimeoutHeaderInfinite() { - $request = HTTP\Sapi::createFromServerArray(array( + $request = HTTP\Sapi::createFromServerArray([ 'HTTP_TIMEOUT' => 'infinite, second-5', - )); + ]); $this->server->httpRequest = $request; $this->assertEquals(LockInfo::TIMEOUT_INFINITE, $this->locksPlugin->getTimeoutHeader()); @@ -990,9 +990,9 @@ class PluginTest extends DAV\AbstractServer { */ function testGetTimeoutHeaderInvalid() { - $request = HTTP\Sapi::createFromServerArray(array( + $request = HTTP\Sapi::createFromServerArray([ 'HTTP_TIMEOUT' => 'yourmom', - )); + ]); $this->server->httpRequest = $request; $this->locksPlugin->getTimeoutHeader(); diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Mount/PluginTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Mount/PluginTest.php index e6415792c..3213fcb1b 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Mount/PluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Mount/PluginTest.php @@ -18,27 +18,27 @@ class PluginTest extends DAV\AbstractServer { function testPassThrough() { - $serverVars = array( + $serverVars = [ 'REQUEST_URI' => '/', 'REQUEST_METHOD' => 'GET', - ); + ]; $request = HTTP\Sapi::createFromServerArray($serverVars); $this->server->httpRequest = ($request); $this->server->exec(); - $this->assertEquals(501, $this->response->status,'We expected GET to not be implemented for Directories. Response body: ' . $this->response->body); + $this->assertEquals(501, $this->response->status, 'We expected GET to not be implemented for Directories. Response body: ' . $this->response->body); } function testMountResponse() { - $serverVars = array( + $serverVars = [ 'REQUEST_URI' => '/?mount', 'REQUEST_METHOD' => 'GET', 'QUERY_STRING' => 'mount', 'HTTP_HOST' => 'example.org', - ); + ]; $request = HTTP\Sapi::createFromServerArray($serverVars); $this->server->httpRequest = ($request); @@ -47,11 +47,11 @@ class PluginTest extends DAV\AbstractServer { $this->assertEquals(200, $this->response->status); $xml = simplexml_load_string($this->response->body); - $this->assertInstanceOf('SimpleXMLElement',$xml, 'Response was not a valid xml document. The list of errors:' . print_r(libxml_get_errors(),true) . '. xml body: ' . $this->response->body . '. What type we got: ' . gettype($xml) . ' class, if object: ' . get_class($xml)); + $this->assertInstanceOf('SimpleXMLElement', $xml, 'Response was not a valid xml document. The list of errors:' . print_r(libxml_get_errors(), true) . '. xml body: ' . $this->response->body . '. What type we got: ' . gettype($xml) . ' class, if object: ' . get_class($xml)); - $xml->registerXPathNamespace('dm','http://purl.org/NET/webdav/mount'); + $xml->registerXPathNamespace('dm', 'http://purl.org/NET/webdav/mount'); $url = $xml->xpath('//dm:url'); - $this->assertEquals('http://example.org/',(string)$url[0]); + $this->assertEquals('http://example.org/', (string)$url[0]); } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ObjectTreeTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ObjectTreeTest.php index 9b7eeb90c..15289ce52 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/ObjectTreeTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/ObjectTreeTest.php @@ -13,8 +13,8 @@ class ObjectTreeTest extends \PHPUnit_Framework_TestCase { \Sabre\TestUtil::clearTempDir(); mkdir(SABRE_TEMPDIR . '/root'); mkdir(SABRE_TEMPDIR . '/root/subdir'); - file_put_contents(SABRE_TEMPDIR . '/root/file.txt','contents'); - file_put_contents(SABRE_TEMPDIR . '/root/subdir/subfile.txt','subcontents'); + file_put_contents(SABRE_TEMPDIR . '/root/file.txt', 'contents'); + file_put_contents(SABRE_TEMPDIR . '/root/subdir/subfile.txt', 'subcontents'); $rootNode = new FSExt\Directory(SABRE_TEMPDIR . '/root'); $this->tree = new Tree($rootNode); @@ -29,22 +29,22 @@ class ObjectTreeTest extends \PHPUnit_Framework_TestCase { function testGetRootNode() { $root = $this->tree->getNodeForPath(''); - $this->assertInstanceOf('Sabre\\DAV\\FSExt\\Directory',$root); + $this->assertInstanceOf('Sabre\\DAV\\FSExt\\Directory', $root); } function testGetSubDir() { $root = $this->tree->getNodeForPath('subdir'); - $this->assertInstanceOf('Sabre\\DAV\\FSExt\\Directory',$root); + $this->assertInstanceOf('Sabre\\DAV\\FSExt\\Directory', $root); } function testCopyFile() { - $this->tree->copy('file.txt','file2.txt'); - $this->assertTrue(file_exists(SABRE_TEMPDIR.'/root/file2.txt')); - $this->assertEquals('contents',file_get_contents(SABRE_TEMPDIR.'/root/file2.txt')); + $this->tree->copy('file.txt', 'file2.txt'); + $this->assertTrue(file_exists(SABRE_TEMPDIR . '/root/file2.txt')); + $this->assertEquals('contents', file_get_contents(SABRE_TEMPDIR . '/root/file2.txt')); } @@ -53,10 +53,10 @@ class ObjectTreeTest extends \PHPUnit_Framework_TestCase { */ function testCopyDirectory() { - $this->tree->copy('subdir','subdir2'); - $this->assertTrue(file_exists(SABRE_TEMPDIR.'/root/subdir2')); - $this->assertTrue(file_exists(SABRE_TEMPDIR.'/root/subdir2/subfile.txt')); - $this->assertEquals('subcontents',file_get_contents(SABRE_TEMPDIR.'/root/subdir2/subfile.txt')); + $this->tree->copy('subdir', 'subdir2'); + $this->assertTrue(file_exists(SABRE_TEMPDIR . '/root/subdir2')); + $this->assertTrue(file_exists(SABRE_TEMPDIR . '/root/subdir2/subfile.txt')); + $this->assertEquals('subcontents', file_get_contents(SABRE_TEMPDIR . '/root/subdir2/subfile.txt')); } @@ -65,10 +65,10 @@ class ObjectTreeTest extends \PHPUnit_Framework_TestCase { */ function testMoveFile() { - $this->tree->move('file.txt','file2.txt'); - $this->assertTrue(file_exists(SABRE_TEMPDIR.'/root/file2.txt')); - $this->assertFalse(file_exists(SABRE_TEMPDIR.'/root/file.txt')); - $this->assertEquals('contents',file_get_contents(SABRE_TEMPDIR.'/root/file2.txt')); + $this->tree->move('file.txt', 'file2.txt'); + $this->assertTrue(file_exists(SABRE_TEMPDIR . '/root/file2.txt')); + $this->assertFalse(file_exists(SABRE_TEMPDIR . '/root/file.txt')); + $this->assertEquals('contents', file_get_contents(SABRE_TEMPDIR . '/root/file2.txt')); } @@ -77,10 +77,10 @@ class ObjectTreeTest extends \PHPUnit_Framework_TestCase { */ function testMoveFileNewParent() { - $this->tree->move('file.txt','subdir/file2.txt'); - $this->assertTrue(file_exists(SABRE_TEMPDIR.'/root/subdir/file2.txt')); - $this->assertFalse(file_exists(SABRE_TEMPDIR.'/root/file.txt')); - $this->assertEquals('contents',file_get_contents(SABRE_TEMPDIR.'/root/subdir/file2.txt')); + $this->tree->move('file.txt', 'subdir/file2.txt'); + $this->assertTrue(file_exists(SABRE_TEMPDIR . '/root/subdir/file2.txt')); + $this->assertFalse(file_exists(SABRE_TEMPDIR . '/root/file.txt')); + $this->assertEquals('contents', file_get_contents(SABRE_TEMPDIR . '/root/subdir/file2.txt')); } @@ -89,11 +89,11 @@ class ObjectTreeTest extends \PHPUnit_Framework_TestCase { */ function testMoveDirectory() { - $this->tree->move('subdir','subdir2'); - $this->assertTrue(file_exists(SABRE_TEMPDIR.'/root/subdir2')); - $this->assertTrue(file_exists(SABRE_TEMPDIR.'/root/subdir2/subfile.txt')); - $this->assertFalse(file_exists(SABRE_TEMPDIR.'/root/subdir')); - $this->assertEquals('subcontents',file_get_contents(SABRE_TEMPDIR.'/root/subdir2/subfile.txt')); + $this->tree->move('subdir', 'subdir2'); + $this->assertTrue(file_exists(SABRE_TEMPDIR . '/root/subdir2')); + $this->assertTrue(file_exists(SABRE_TEMPDIR . '/root/subdir2/subfile.txt')); + $this->assertFalse(file_exists(SABRE_TEMPDIR . '/root/subdir')); + $this->assertEquals('subcontents', file_get_contents(SABRE_TEMPDIR . '/root/subdir2/subfile.txt')); } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/PartialUpdate/FileMock.php b/vendor/sabre/dav/tests/Sabre/DAV/PartialUpdate/FileMock.php index d6cc406be..eff1e7d67 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/PartialUpdate/FileMock.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/PartialUpdate/FileMock.php @@ -1,6 +1,7 @@ <?php namespace Sabre\DAV\PartialUpdate; + use Sabre\DAV; class FileMock implements IPatchSupport { @@ -49,10 +50,10 @@ class FileMock implements IPatchSupport { $data = stream_get_contents($data); } - switch($rangeType) { + switch ($rangeType) { case 1 : - $this->data.=$data; + $this->data .= $data; break; case 3 : // Turn the offset into an offset-offset. diff --git a/vendor/sabre/dav/tests/Sabre/DAV/PartialUpdate/SpecificationTest.php b/vendor/sabre/dav/tests/Sabre/DAV/PartialUpdate/SpecificationTest.php index 31be2a1b1..ca8ca3f6e 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/PartialUpdate/SpecificationTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/PartialUpdate/SpecificationTest.php @@ -16,11 +16,11 @@ class SpecificationTest extends \PHPUnit_Framework_TestCase { protected $server; - public function setUp() { + function setUp() { - $tree = array( + $tree = [ new File(SABRE_TEMPDIR . '/foobar.txt') - ); + ]; $server = new Server($tree); $server->debugExceptions = true; $server->addPlugin(new Plugin()); @@ -31,7 +31,7 @@ class SpecificationTest extends \PHPUnit_Framework_TestCase { } - public function tearDown() { + function tearDown() { \Sabre\TestUtil::clearTempDir(); @@ -40,10 +40,10 @@ class SpecificationTest extends \PHPUnit_Framework_TestCase { /** * @dataProvider data */ - public function testUpdateRange($headerValue, $httpStatus, $endResult, $contentLength = 4) { + function testUpdateRange($headerValue, $httpStatus, $endResult, $contentLength = 4) { $headers = [ - 'Content-Type' => 'application/x-sabredav-partialupdate', + 'Content-Type' => 'application/x-sabredav-partialupdate', 'X-Update-Range' => $headerValue, ]; @@ -64,25 +64,25 @@ class SpecificationTest extends \PHPUnit_Framework_TestCase { $this->assertEquals($endResult, file_get_contents(SABRE_TEMPDIR . '/foobar.txt')); } - } + } - public function data() { + function data() { - return array( + return [ // Problems - array('foo', 400, null), - array('bytes=0-3', 411, null, 0), - array('bytes=4-1', 416, null), - - array('bytes=0-3', 204, '----567890'), - array('bytes=1-4', 204, '1----67890'), - array('bytes=0-', 204, '----567890'), - array('bytes=-4', 204, '123456----'), - array('bytes=-2', 204, '12345678----'), - array('bytes=2-', 204, '12----7890'), - array('append', 204, '1234567890----'), - - ); + ['foo', 400, null], + ['bytes=0-3', 411, null, 0], + ['bytes=4-1', 416, null], + + ['bytes=0-3', 204, '----567890'], + ['bytes=1-4', 204, '1----67890'], + ['bytes=0-', 204, '----567890'], + ['bytes=-4', 204, '123456----'], + ['bytes=-2', 204, '12345678----'], + ['bytes=2-', 204, '12----7890'], + ['append', 204, '1234567890----'], + + ]; } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ServerMKCOLTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ServerMKCOLTest.php index e35189ec3..557eddbbc 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/ServerMKCOLTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/ServerMKCOLTest.php @@ -8,20 +8,20 @@ class ServerMKCOLTest extends AbstractServer { function testMkcol() { - $serverVars = array( + $serverVars = [ 'REQUEST_URI' => '/testcol', 'REQUEST_METHOD' => 'MKCOL', - ); + ]; $request = HTTP\Sapi::createFromServerArray($serverVars); $request->setBody(""); $this->server->httpRequest = ($request); $this->server->exec(); - $this->assertEquals(array( + $this->assertEquals([ 'X-Sabre-Version' => [Version::VERSION], - 'Content-Length' => ['0'], - ),$this->response->getHeaders()); + 'Content-Length' => ['0'], + ], $this->response->getHeaders()); $this->assertEquals(201, $this->response->status); $this->assertEquals('', $this->response->body); @@ -34,20 +34,20 @@ class ServerMKCOLTest extends AbstractServer { */ function testMKCOLUnknownBody() { - $serverVars = array( + $serverVars = [ 'REQUEST_URI' => '/testcol', 'REQUEST_METHOD' => 'MKCOL', - ); + ]; $request = HTTP\Sapi::createFromServerArray($serverVars); $request->setBody("Hello"); $this->server->httpRequest = ($request); $this->server->exec(); - $this->assertEquals(array( + $this->assertEquals([ 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - ),$this->response->getHeaders()); + 'Content-Type' => ['application/xml; charset=utf-8'], + ], $this->response->getHeaders()); $this->assertEquals(415, $this->response->status); @@ -58,23 +58,23 @@ class ServerMKCOLTest extends AbstractServer { */ function testMKCOLBrokenXML() { - $serverVars = array( - 'REQUEST_URI' => '/testcol', - 'REQUEST_METHOD' => 'MKCOL', + $serverVars = [ + 'REQUEST_URI' => '/testcol', + 'REQUEST_METHOD' => 'MKCOL', 'HTTP_CONTENT_TYPE' => 'application/xml', - ); + ]; $request = HTTP\Sapi::createFromServerArray($serverVars); $request->setBody("Hello"); $this->server->httpRequest = ($request); $this->server->exec(); - $this->assertEquals(array( + $this->assertEquals([ 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - ),$this->response->getHeaders()); + 'Content-Type' => ['application/xml; charset=utf-8'], + ], $this->response->getHeaders()); - $this->assertEquals(400, $this->response->getStatus(), $this->response->getBodyAsString() ); + $this->assertEquals(400, $this->response->getStatus(), $this->response->getBodyAsString()); } @@ -83,21 +83,21 @@ class ServerMKCOLTest extends AbstractServer { */ function testMKCOLUnknownXML() { - $serverVars = array( - 'REQUEST_URI' => '/testcol', - 'REQUEST_METHOD' => 'MKCOL', + $serverVars = [ + 'REQUEST_URI' => '/testcol', + 'REQUEST_METHOD' => 'MKCOL', 'HTTP_CONTENT_TYPE' => 'application/xml', - ); + ]; $request = HTTP\Sapi::createFromServerArray($serverVars); $request->setBody('<?xml version="1.0"?><html></html>'); $this->server->httpRequest = ($request); $this->server->exec(); - $this->assertEquals(array( + $this->assertEquals([ 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - ),$this->response->getHeaders()); + 'Content-Type' => ['application/xml; charset=utf-8'], + ], $this->response->getHeaders()); $this->assertEquals(400, $this->response->getStatus()); @@ -108,11 +108,11 @@ class ServerMKCOLTest extends AbstractServer { */ function testMKCOLNoResourceType() { - $serverVars = array( - 'REQUEST_URI' => '/testcol', - 'REQUEST_METHOD' => 'MKCOL', + $serverVars = [ + 'REQUEST_URI' => '/testcol', + 'REQUEST_METHOD' => 'MKCOL', 'HTTP_CONTENT_TYPE' => 'application/xml', - ); + ]; $request = HTTP\Sapi::createFromServerArray($serverVars); $request->setBody('<?xml version="1.0"?> @@ -126,12 +126,12 @@ class ServerMKCOLTest extends AbstractServer { $this->server->httpRequest = ($request); $this->server->exec(); - $this->assertEquals(array( + $this->assertEquals([ 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - ),$this->response->getHeaders()); + 'Content-Type' => ['application/xml; charset=utf-8'], + ], $this->response->getHeaders()); - $this->assertEquals(400, $this->response->status, 'Wrong statuscode received. Full response body: ' .$this->response->body); + $this->assertEquals(400, $this->response->status, 'Wrong statuscode received. Full response body: ' . $this->response->body); } @@ -140,11 +140,11 @@ class ServerMKCOLTest extends AbstractServer { */ function testMKCOLIncorrectResourceType() { - $serverVars = array( - 'REQUEST_URI' => '/testcol', - 'REQUEST_METHOD' => 'MKCOL', + $serverVars = [ + 'REQUEST_URI' => '/testcol', + 'REQUEST_METHOD' => 'MKCOL', 'HTTP_CONTENT_TYPE' => 'application/xml', - ); + ]; $request = HTTP\Sapi::createFromServerArray($serverVars); $request->setBody('<?xml version="1.0"?> @@ -158,12 +158,12 @@ class ServerMKCOLTest extends AbstractServer { $this->server->httpRequest = ($request); $this->server->exec(); - $this->assertEquals(array( + $this->assertEquals([ 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - ),$this->response->getHeaders()); + 'Content-Type' => ['application/xml; charset=utf-8'], + ], $this->response->getHeaders()); - $this->assertEquals(403, $this->response->status, 'Wrong statuscode received. Full response body: ' .$this->response->body); + $this->assertEquals(403, $this->response->status, 'Wrong statuscode received. Full response body: ' . $this->response->body); } @@ -172,11 +172,11 @@ class ServerMKCOLTest extends AbstractServer { */ function testMKCOLSuccess() { - $serverVars = array( - 'REQUEST_URI' => '/testcol', - 'REQUEST_METHOD' => 'MKCOL', + $serverVars = [ + 'REQUEST_URI' => '/testcol', + 'REQUEST_METHOD' => 'MKCOL', 'HTTP_CONTENT_TYPE' => 'application/xml', - ); + ]; $request = HTTP\Sapi::createFromServerArray($serverVars); $request->setBody('<?xml version="1.0"?> @@ -190,12 +190,12 @@ class ServerMKCOLTest extends AbstractServer { $this->server->httpRequest = ($request); $this->server->exec(); - $this->assertEquals(array( + $this->assertEquals([ 'X-Sabre-Version' => [Version::VERSION], - 'Content-Length' => ['0'], - ),$this->response->getHeaders()); + 'Content-Length' => ['0'], + ], $this->response->getHeaders()); - $this->assertEquals(201, $this->response->status, 'Wrong statuscode received. Full response body: ' .$this->response->body); + $this->assertEquals(201, $this->response->status, 'Wrong statuscode received. Full response body: ' . $this->response->body); } @@ -204,11 +204,11 @@ class ServerMKCOLTest extends AbstractServer { */ function testMKCOLWhiteSpaceResourceType() { - $serverVars = array( - 'REQUEST_URI' => '/testcol', - 'REQUEST_METHOD' => 'MKCOL', + $serverVars = [ + 'REQUEST_URI' => '/testcol', + 'REQUEST_METHOD' => 'MKCOL', 'HTTP_CONTENT_TYPE' => 'application/xml', - ); + ]; $request = HTTP\Sapi::createFromServerArray($serverVars); $request->setBody('<?xml version="1.0"?> @@ -224,12 +224,12 @@ class ServerMKCOLTest extends AbstractServer { $this->server->httpRequest = ($request); $this->server->exec(); - $this->assertEquals(array( + $this->assertEquals([ 'X-Sabre-Version' => [Version::VERSION], - 'Content-Length' => ['0'], - ),$this->response->getHeaders()); + 'Content-Length' => ['0'], + ], $this->response->getHeaders()); - $this->assertEquals(201, $this->response->status, 'Wrong statuscode received. Full response body: ' .$this->response->body); + $this->assertEquals(201, $this->response->status, 'Wrong statuscode received. Full response body: ' . $this->response->body); } @@ -238,10 +238,10 @@ class ServerMKCOLTest extends AbstractServer { */ function testMKCOLNoParent() { - $serverVars = array( + $serverVars = [ 'REQUEST_URI' => '/testnoparent/409me', 'REQUEST_METHOD' => 'MKCOL', - ); + ]; $request = HTTP\Sapi::createFromServerArray($serverVars); $request->setBody(''); @@ -249,12 +249,12 @@ class ServerMKCOLTest extends AbstractServer { $this->server->httpRequest = ($request); $this->server->exec(); - $this->assertEquals(array( + $this->assertEquals([ 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - ),$this->response->getHeaders()); + 'Content-Type' => ['application/xml; charset=utf-8'], + ], $this->response->getHeaders()); - $this->assertEquals(409, $this->response->status, 'Wrong statuscode received. Full response body: ' .$this->response->body); + $this->assertEquals(409, $this->response->status, 'Wrong statuscode received. Full response body: ' . $this->response->body); } @@ -263,10 +263,10 @@ class ServerMKCOLTest extends AbstractServer { */ function testMKCOLParentIsNoCollection() { - $serverVars = array( + $serverVars = [ 'REQUEST_URI' => '/test.txt/409me', 'REQUEST_METHOD' => 'MKCOL', - ); + ]; $request = HTTP\Sapi::createFromServerArray($serverVars); $request->setBody(''); @@ -274,12 +274,12 @@ class ServerMKCOLTest extends AbstractServer { $this->server->httpRequest = ($request); $this->server->exec(); - $this->assertEquals(array( + $this->assertEquals([ 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - ),$this->response->getHeaders()); + 'Content-Type' => ['application/xml; charset=utf-8'], + ], $this->response->getHeaders()); - $this->assertEquals(409, $this->response->status, 'Wrong statuscode received. Full response body: ' .$this->response->body); + $this->assertEquals(409, $this->response->status, 'Wrong statuscode received. Full response body: ' . $this->response->body); } @@ -288,10 +288,10 @@ class ServerMKCOLTest extends AbstractServer { */ function testMKCOLAlreadyExists() { - $serverVars = array( + $serverVars = [ 'REQUEST_URI' => '/test.txt', 'REQUEST_METHOD' => 'MKCOL', - ); + ]; $request = HTTP\Sapi::createFromServerArray($serverVars); $request->setBody(''); @@ -299,13 +299,13 @@ class ServerMKCOLTest extends AbstractServer { $this->server->httpRequest = ($request); $this->server->exec(); - $this->assertEquals(array( + $this->assertEquals([ 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - 'Allow' => ['OPTIONS, GET, HEAD, DELETE, PROPFIND, PUT, PROPPATCH, COPY, MOVE, REPORT'], - ),$this->response->getHeaders()); + 'Content-Type' => ['application/xml; charset=utf-8'], + 'Allow' => ['OPTIONS, GET, HEAD, DELETE, PROPFIND, PUT, PROPPATCH, COPY, MOVE, REPORT'], + ], $this->response->getHeaders()); - $this->assertEquals(405, $this->response->status, 'Wrong statuscode received. Full response body: ' .$this->response->body); + $this->assertEquals(405, $this->response->status, 'Wrong statuscode received. Full response body: ' . $this->response->body); } @@ -315,13 +315,11 @@ class ServerMKCOLTest extends AbstractServer { */ function testMKCOLAndProps() { - $serverVars = array( - 'REQUEST_URI' => '/testcol', - 'REQUEST_METHOD' => 'MKCOL', - 'HTTP_CONTENT_TYPE' => 'application/xml', + $request = new HTTP\Request( + 'MKCOL', + '/testcol', + ['Content-Type' => 'application/xml'] ); - - $request = HTTP\Sapi::createFromServerArray($serverVars); $request->setBody('<?xml version="1.0"?> <mkcol xmlns="DAV:"> <set> @@ -334,12 +332,34 @@ class ServerMKCOLTest extends AbstractServer { $this->server->httpRequest = ($request); $this->server->exec(); - $this->assertEquals(207, $this->response->status, 'Wrong statuscode received. Full response body: ' .$this->response->body); + $this->assertEquals(207, $this->response->status, 'Wrong statuscode received. Full response body: ' . $this->response->body); - $this->assertEquals(array( + $this->assertEquals([ 'X-Sabre-Version' => [Version::VERSION], - 'Content-Type' => ['application/xml; charset=utf-8'], - ),$this->response->getHeaders()); + 'Content-Type' => ['application/xml; charset=utf-8'], + ], $this->response->getHeaders()); + + $responseBody = $this->response->getBodyAsString(); + + $expected = <<<XML +<?xml version="1.0"?> +<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns"> + <d:response> + <d:href>/testcol</d:href> + <d:propstat> + <d:prop> + <d:displayname /> + </d:prop> + <d:status>HTTP/1.1 403 Forbidden</d:status> + </d:propstat> + </d:response> +</d:multistatus> +XML; + + $this->assertXmlStringEqualsXmlString( + $expected, + $responseBody + ); } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ServerPluginTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ServerPluginTest.php index ab0ad295e..fa67102cc 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/ServerPluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/ServerPluginTest.php @@ -1,6 +1,7 @@ <?php namespace Sabre\DAV; + use Sabre\HTTP; require_once 'Sabre/DAV/AbstractServer.php'; @@ -28,13 +29,13 @@ class ServerPluginTest extends AbstractServer { function testBaseClass() { $p = new ServerPluginMock(); - $this->assertEquals([],$p->getFeatures()); - $this->assertEquals([],$p->getHTTPMethods('')); + $this->assertEquals([], $p->getFeatures()); + $this->assertEquals([], $p->getHTTPMethods('')); $this->assertEquals( [ - 'name' => 'Sabre\DAV\ServerPluginMock', + 'name' => 'Sabre\DAV\ServerPluginMock', 'description' => null, - 'link' => null + 'link' => null ], $p->getPluginInfo() ); @@ -42,34 +43,34 @@ class ServerPluginTest extends AbstractServer { function testOptions() { - $serverVars = array( + $serverVars = [ 'REQUEST_URI' => '/', 'REQUEST_METHOD' => 'OPTIONS', - ); + ]; $request = HTTP\Sapi::createFromServerArray($serverVars); $this->server->httpRequest = ($request); $this->server->exec(); - $this->assertEquals(array( + $this->assertEquals([ 'DAV' => ['1, 3, extended-mkcol, drinking'], 'MS-Author-Via' => ['DAV'], 'Allow' => ['OPTIONS, GET, HEAD, DELETE, PROPFIND, PUT, PROPPATCH, COPY, MOVE, REPORT, BEER, WINE'], 'Accept-Ranges' => ['bytes'], 'Content-Length' => ['0'], 'X-Sabre-Version' => [Version::VERSION], - ),$this->response->getHeaders()); + ], $this->response->getHeaders()); $this->assertEquals(200, $this->response->status); $this->assertEquals('', $this->response->body); - $this->assertEquals('OPTIONS',$this->testPlugin->beforeMethod); + $this->assertEquals('OPTIONS', $this->testPlugin->beforeMethod); } function testGetPlugin() { - $this->assertEquals($this->testPlugin,$this->server->getPlugin(get_class($this->testPlugin))); + $this->assertEquals($this->testPlugin, $this->server->getPlugin(get_class($this->testPlugin))); } @@ -81,17 +82,17 @@ class ServerPluginTest extends AbstractServer { function testGetSupportedReportSet() { - $this->assertEquals(array(), $this->testPlugin->getSupportedReportSet('/')); + $this->assertEquals([], $this->testPlugin->getSupportedReportSet('/')); } function testGetPlugins() { $this->assertEquals( - array( + [ get_class($this->testPlugin) => $this->testPlugin, - 'core' => $this->server->getPlugin('core'), - ), + 'core' => $this->server->getPlugin('core'), + ], $this->server->getPlugins() ); diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ServerPreconditionTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ServerPreconditionTest.php index 1dc8d8a37..203cf26d9 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/ServerPreconditionTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/ServerPreconditionTest.php @@ -13,7 +13,7 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase { */ function testIfMatchNoNode() { - $root = new SimpleCollection('root',array(new ServerPreconditionsNode())); + $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); $server = new Server($root); $httpRequest = new HTTP\Request('GET', '/bar', ['If-Match' => '*']); $httpResponse = new HTTP\Response(); @@ -25,7 +25,7 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase { */ function testIfMatchHasNode() { - $root = new SimpleCollection('root',array(new ServerPreconditionsNode())); + $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); $server = new Server($root); $httpRequest = new HTTP\Request('GET', '/foo', ['If-Match' => '*']); $httpResponse = new HTTP\Response(); @@ -38,7 +38,7 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase { */ function testIfMatchWrongEtag() { - $root = new SimpleCollection('root',array(new ServerPreconditionsNode())); + $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); $server = new Server($root); $httpRequest = new HTTP\Request('GET', '/foo', ['If-Match' => '1234']); $httpResponse = new HTTP\Response(); @@ -50,7 +50,7 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase { */ function testIfMatchCorrectEtag() { - $root = new SimpleCollection('root',array(new ServerPreconditionsNode())); + $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); $server = new Server($root); $httpRequest = new HTTP\Request('GET', '/foo', ['If-Match' => '"abc123"']); $httpResponse = new HTTP\Response(); @@ -65,7 +65,7 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase { */ function testIfMatchEvolutionEtag() { - $root = new SimpleCollection('root',array(new ServerPreconditionsNode())); + $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); $server = new Server($root); $httpRequest = new HTTP\Request('GET', '/foo', ['If-Match' => '\\"abc123\\"']); $httpResponse = new HTTP\Response(); @@ -77,7 +77,7 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase { */ function testIfMatchMultiple() { - $root = new SimpleCollection('root',array(new ServerPreconditionsNode())); + $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); $server = new Server($root); $httpRequest = new HTTP\Request('GET', '/foo', ['If-Match' => '"hellothere", "abc123"']); $httpResponse = new HTTP\Response(); @@ -89,7 +89,7 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase { */ function testIfNoneMatchNoNode() { - $root = new SimpleCollection('root',array(new ServerPreconditionsNode())); + $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); $server = new Server($root); $httpRequest = new HTTP\Request('GET', '/bar', ['If-None-Match' => '*']); $httpResponse = new HTTP\Response(); @@ -102,7 +102,7 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase { */ function testIfNoneMatchHasNode() { - $root = new SimpleCollection('root',array(new ServerPreconditionsNode())); + $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); $server = new Server($root); $httpRequest = new HTTP\Request('POST', '/foo', ['If-None-Match' => '*']); $httpResponse = new HTTP\Response(); @@ -114,7 +114,7 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase { */ function testIfNoneMatchWrongEtag() { - $root = new SimpleCollection('root',array(new ServerPreconditionsNode())); + $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); $server = new Server($root); $httpRequest = new HTTP\Request('POST', '/foo', ['If-None-Match' => '"1234"']); $httpResponse = new HTTP\Response(); @@ -126,7 +126,7 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase { */ function testIfNoneMatchWrongEtagMultiple() { - $root = new SimpleCollection('root',array(new ServerPreconditionsNode())); + $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); $server = new Server($root); $httpRequest = new HTTP\Request('POST', '/foo', ['If-None-Match' => '"1234", "5678"']); $httpResponse = new HTTP\Response(); @@ -137,9 +137,9 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase { /** * @expectedException Sabre\DAV\Exception\PreconditionFailed */ - public function testIfNoneMatchCorrectEtag() { + function testIfNoneMatchCorrectEtag() { - $root = new SimpleCollection('root',array(new ServerPreconditionsNode())); + $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); $server = new Server($root); $httpRequest = new HTTP\Request('POST', '/foo', ['If-None-Match' => '"abc123"']); $httpResponse = new HTTP\Response(); @@ -150,9 +150,9 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase { /** * @expectedException Sabre\DAV\Exception\PreconditionFailed */ - public function testIfNoneMatchCorrectEtagMultiple() { + function testIfNoneMatchCorrectEtagMultiple() { - $root = new SimpleCollection('root',array(new ServerPreconditionsNode())); + $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); $server = new Server($root); $httpRequest = new HTTP\Request('POST', '/foo', ['If-None-Match' => '"1234, "abc123"']); $httpResponse = new HTTP\Response(); @@ -162,9 +162,9 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase { /** */ - public function testIfNoneMatchCorrectEtagAsGet() { + function testIfNoneMatchCorrectEtagAsGet() { - $root = new SimpleCollection('root',array(new ServerPreconditionsNode())); + $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); $server = new Server($root); $httpRequest = new HTTP\Request('GET', '/foo', ['If-None-Match' => '"abc123"']); $server->httpResponse = new HTTP\ResponseMock(); @@ -178,9 +178,9 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase { /** * This was a test written for issue #515. */ - public function testNoneMatchCorrectEtagEnsureSapiSent() { + function testNoneMatchCorrectEtagEnsureSapiSent() { - $root = new SimpleCollection('root',array(new ServerPreconditionsNode())); + $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); $server = new Server($root); $server->sapi = new HTTP\SapiMock(); HTTP\SapiMock::$sent = 0; @@ -193,7 +193,7 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase { $this->assertFalse($server->checkPreconditions($httpRequest, $server->httpResponse)); $this->assertEquals(304, $server->httpResponse->getStatus()); $this->assertEquals([ - 'ETag' => ['"abc123"'], + 'ETag' => ['"abc123"'], 'X-Sabre-Version' => [Version::VERSION], ], $server->httpResponse->getHeaders()); $this->assertEquals(1, HTTP\SapiMock::$sent); @@ -202,35 +202,35 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase { /** */ - public function testIfModifiedSinceUnModified() { + function testIfModifiedSinceUnModified() { - $root = new SimpleCollection('root',array(new ServerPreconditionsNode())); + $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); $server = new Server($root); - $httpRequest = HTTP\Sapi::createFromServerArray(array( + $httpRequest = HTTP\Sapi::createFromServerArray([ 'HTTP_IF_MODIFIED_SINCE' => 'Sun, 06 Nov 1994 08:49:37 GMT', - 'REQUEST_URI' => '/foo' - )); + 'REQUEST_URI' => '/foo' + ]); $server->httpResponse = new HTTP\ResponseMock(); $this->assertFalse($server->checkPreconditions($httpRequest, $server->httpResponse)); $this->assertEquals(304, $server->httpResponse->status); - $this->assertEquals(array( + $this->assertEquals([ 'Last-Modified' => ['Sat, 06 Apr 1985 23:30:00 GMT'], - ), $server->httpResponse->getHeaders()); + ], $server->httpResponse->getHeaders()); } /** */ - public function testIfModifiedSinceModified() { + function testIfModifiedSinceModified() { - $root = new SimpleCollection('root',array(new ServerPreconditionsNode())); + $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); $server = new Server($root); - $httpRequest = HTTP\Sapi::createFromServerArray(array( + $httpRequest = HTTP\Sapi::createFromServerArray([ 'HTTP_IF_MODIFIED_SINCE' => 'Tue, 06 Nov 1984 08:49:37 GMT', - 'REQUEST_URI' => '/foo' - )); + 'REQUEST_URI' => '/foo' + ]); $httpResponse = new HTTP\ResponseMock(); $this->assertTrue($server->checkPreconditions($httpRequest, $httpResponse)); @@ -239,14 +239,14 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase { /** */ - public function testIfModifiedSinceInvalidDate() { + function testIfModifiedSinceInvalidDate() { - $root = new SimpleCollection('root',array(new ServerPreconditionsNode())); + $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); $server = new Server($root); - $httpRequest = HTTP\Sapi::createFromServerArray(array( + $httpRequest = HTTP\Sapi::createFromServerArray([ 'HTTP_IF_MODIFIED_SINCE' => 'Your mother', - 'REQUEST_URI' => '/foo' - )); + 'REQUEST_URI' => '/foo' + ]); $httpResponse = new HTTP\ResponseMock(); // Invalid dates must be ignored, so this should return true @@ -256,14 +256,14 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase { /** */ - public function testIfModifiedSinceInvalidDate2() { + function testIfModifiedSinceInvalidDate2() { - $root = new SimpleCollection('root',array(new ServerPreconditionsNode())); + $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); $server = new Server($root); - $httpRequest = HTTP\Sapi::createFromServerArray(array( + $httpRequest = HTTP\Sapi::createFromServerArray([ 'HTTP_IF_MODIFIED_SINCE' => 'Sun, 06 Nov 1994 08:49:37 EST', - 'REQUEST_URI' => '/foo' - )); + 'REQUEST_URI' => '/foo' + ]); $httpResponse = new HTTP\ResponseMock(); $this->assertTrue($server->checkPreconditions($httpRequest, $httpResponse)); @@ -272,14 +272,14 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase { /** */ - public function testIfUnmodifiedSinceUnModified() { + function testIfUnmodifiedSinceUnModified() { - $root = new SimpleCollection('root',array(new ServerPreconditionsNode())); + $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); $server = new Server($root); - $httpRequest = HTTP\Sapi::createFromServerArray(array( + $httpRequest = HTTP\Sapi::createFromServerArray([ 'HTTP_IF_UNMODIFIED_SINCE' => 'Sun, 06 Nov 1994 08:49:37 GMT', - 'REQUEST_URI' => '/foo' - )); + 'REQUEST_URI' => '/foo' + ]); $httpResponse = new HTTP\Response(); $this->assertTrue($server->checkPreconditions($httpRequest, $httpResponse)); @@ -289,14 +289,14 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase { /** * @expectedException Sabre\DAV\Exception\PreconditionFailed */ - public function testIfUnmodifiedSinceModified() { + function testIfUnmodifiedSinceModified() { - $root = new SimpleCollection('root',array(new ServerPreconditionsNode())); + $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); $server = new Server($root); - $httpRequest = HTTP\Sapi::createFromServerArray(array( + $httpRequest = HTTP\Sapi::createFromServerArray([ 'HTTP_IF_UNMODIFIED_SINCE' => 'Tue, 06 Nov 1984 08:49:37 GMT', - 'REQUEST_URI' => '/foo' - )); + 'REQUEST_URI' => '/foo' + ]); $httpResponse = new HTTP\ResponseMock(); $server->checkPreconditions($httpRequest, $httpResponse); @@ -304,14 +304,14 @@ class ServerPreconditionsTest extends \PHPUnit_Framework_TestCase { /** */ - public function testIfUnmodifiedSinceInvalidDate() { + function testIfUnmodifiedSinceInvalidDate() { - $root = new SimpleCollection('root',array(new ServerPreconditionsNode())); + $root = new SimpleCollection('root', [new ServerPreconditionsNode()]); $server = new Server($root); - $httpRequest = HTTP\Sapi::createFromServerArray(array( + $httpRequest = HTTP\Sapi::createFromServerArray([ 'HTTP_IF_UNMODIFIED_SINCE' => 'Sun, 06 Nov 1984 08:49:37 CET', - 'REQUEST_URI' => '/foo' - )); + 'REQUEST_URI' => '/foo' + ]); $httpResponse = new HTTP\ResponseMock(); $this->assertTrue($server->checkPreconditions($httpRequest, $httpResponse)); diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ServerSimpleTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ServerSimpleTest.php index 66dde9db8..043179a00 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/ServerSimpleTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/ServerSimpleTest.php @@ -463,7 +463,7 @@ class ServerSimpleTest extends AbstractServer{ * There are certain cases where no HTTP status may be set. We need to * intercept these and set it to a default error message. */ - function testNoHTTPSTatusSet() { + function testNoHTTPStatusSet() { $this->server->on('method:GET', function() { return false; }, 1); $this->server->httpRequest = new HTTP\Request('GET', '/'); diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ServerUpdatePropertiesTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ServerUpdatePropertiesTest.php index 7fde11b22..383f8e657 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/ServerUpdatePropertiesTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/ServerUpdatePropertiesTest.php @@ -1,101 +1,100 @@ <?php namespace Sabre\DAV; -use Sabre\HTTP; class ServerUpdatePropertiesTest extends \PHPUnit_Framework_TestCase { function testUpdatePropertiesFail() { - $tree = array( + $tree = [ new SimpleCollection('foo'), - ); + ]; $server = new Server($tree); - $result = $server->updateProperties('foo', array( + $result = $server->updateProperties('foo', [ '{DAV:}foo' => 'bar' - )); + ]); - $expected = array( + $expected = [ '{DAV:}foo' => 403, - ); + ]; $this->assertEquals($expected, $result); } function testUpdatePropertiesProtected() { - $tree = array( + $tree = [ new SimpleCollection('foo'), - ); + ]; $server = new Server($tree); $server->on('propPatch', function($path, PropPatch $propPatch) { $propPatch->handleRemaining(function() { return true; }); }); - $result = $server->updateProperties('foo', array( + $result = $server->updateProperties('foo', [ '{DAV:}getetag' => 'bla', - '{DAV:}foo' => 'bar' - )); + '{DAV:}foo' => 'bar' + ]); - $expected = array( + $expected = [ '{DAV:}getetag' => 403, - '{DAV:}foo' => 424, - ); + '{DAV:}foo' => 424, + ]; $this->assertEquals($expected, $result); } function testUpdatePropertiesEventFail() { - $tree = array( + $tree = [ new SimpleCollection('foo'), - ); + ]; $server = new Server($tree); $server->on('propPatch', function($path, PropPatch $propPatch) { $propPatch->setResultCode('{DAV:}foo', 404); $propPatch->handleRemaining(function() { return true; }); }); - $result = $server->updateProperties('foo', array( - '{DAV:}foo' => 'bar', + $result = $server->updateProperties('foo', [ + '{DAV:}foo' => 'bar', '{DAV:}foo2' => 'bla', - )); + ]); - $expected = array( - '{DAV:}foo' => 404, + $expected = [ + '{DAV:}foo' => 404, '{DAV:}foo2' => 424, - ); + ]; $this->assertEquals($expected, $result); } function testUpdatePropertiesEventSuccess() { - $tree = array( + $tree = [ new SimpleCollection('foo'), - ); + ]; $server = new Server($tree); $server->on('propPatch', function($path, PropPatch $propPatch) { $propPatch->handle(['{DAV:}foo', '{DAV:}foo2'], function() { return [ - '{DAV:}foo' => 200, + '{DAV:}foo' => 200, '{DAV:}foo2' => 201, ]; }); }); - $result = $server->updateProperties('foo', array( - '{DAV:}foo' => 'bar', + $result = $server->updateProperties('foo', [ + '{DAV:}foo' => 'bar', '{DAV:}foo2' => 'bla', - )); + ]); - $expected = array( - '{DAV:}foo' => 200, + $expected = [ + '{DAV:}foo' => 200, '{DAV:}foo2' => 201, - ); + ]; $this->assertEquals($expected, $result); } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/SimpleFileTest.php b/vendor/sabre/dav/tests/Sabre/DAV/SimpleFileTest.php index 9b083b998..15ccfaf9e 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/SimpleFileTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/SimpleFileTest.php @@ -6,7 +6,7 @@ class SimpleFileTest extends \PHPUnit_Framework_TestCase { function testAll() { - $file = new SimpleFile('filename.txt','contents','text/plain'); + $file = new SimpleFile('filename.txt', 'contents', 'text/plain'); $this->assertEquals('filename.txt', $file->getName()); $this->assertEquals('contents', $file->get()); diff --git a/vendor/sabre/dav/tests/Sabre/DAV/StringUtilTest.php b/vendor/sabre/dav/tests/Sabre/DAV/StringUtilTest.php index 941d1f913..8888f0276 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/StringUtilTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/StringUtilTest.php @@ -15,61 +15,61 @@ class StringUtilTest extends \PHPUnit_Framework_TestCase { function dataset() { - return array( - array('FOOBAR', 'FOO', 'i;octet', 'contains', true), - array('FOOBAR', 'foo', 'i;octet', 'contains', false), - array('FÖÖBAR', 'FÖÖ', 'i;octet', 'contains', true), - array('FÖÖBAR', 'föö', 'i;octet', 'contains', false), - array('FOOBAR', 'FOOBAR', 'i;octet', 'equals', true), - array('FOOBAR', 'fooBAR', 'i;octet', 'equals', false), - array('FOOBAR', 'FOO', 'i;octet', 'starts-with', true), - array('FOOBAR', 'foo', 'i;octet', 'starts-with', false), - array('FOOBAR', 'BAR', 'i;octet', 'starts-with', false), - array('FOOBAR', 'bar', 'i;octet', 'starts-with', false), - array('FOOBAR', 'FOO', 'i;octet', 'ends-with', false), - array('FOOBAR', 'foo', 'i;octet', 'ends-with', false), - array('FOOBAR', 'BAR', 'i;octet', 'ends-with', true), - array('FOOBAR', 'bar', 'i;octet', 'ends-with', false), - - array('FOOBAR', 'FOO', 'i;ascii-casemap', 'contains', true), - array('FOOBAR', 'foo', 'i;ascii-casemap', 'contains', true), - array('FÖÖBAR', 'FÖÖ', 'i;ascii-casemap', 'contains', true), - array('FÖÖBAR', 'föö', 'i;ascii-casemap', 'contains', false), - array('FOOBAR', 'FOOBAR', 'i;ascii-casemap', 'equals', true), - array('FOOBAR', 'fooBAR', 'i;ascii-casemap', 'equals', true), - array('FOOBAR', 'FOO', 'i;ascii-casemap', 'starts-with', true), - array('FOOBAR', 'foo', 'i;ascii-casemap', 'starts-with', true), - array('FOOBAR', 'BAR', 'i;ascii-casemap', 'starts-with', false), - array('FOOBAR', 'bar', 'i;ascii-casemap', 'starts-with', false), - array('FOOBAR', 'FOO', 'i;ascii-casemap', 'ends-with', false), - array('FOOBAR', 'foo', 'i;ascii-casemap', 'ends-with', false), - array('FOOBAR', 'BAR', 'i;ascii-casemap', 'ends-with', true), - array('FOOBAR', 'bar', 'i;ascii-casemap', 'ends-with', true), - - array('FOOBAR', 'FOO', 'i;unicode-casemap', 'contains', true), - array('FOOBAR', 'foo', 'i;unicode-casemap', 'contains', true), - array('FÖÖBAR', 'FÖÖ', 'i;unicode-casemap', 'contains', true), - array('FÖÖBAR', 'föö', 'i;unicode-casemap', 'contains', true), - array('FOOBAR', 'FOOBAR', 'i;unicode-casemap', 'equals', true), - array('FOOBAR', 'fooBAR', 'i;unicode-casemap', 'equals', true), - array('FOOBAR', 'FOO', 'i;unicode-casemap', 'starts-with', true), - array('FOOBAR', 'foo', 'i;unicode-casemap', 'starts-with', true), - array('FOOBAR', 'BAR', 'i;unicode-casemap', 'starts-with', false), - array('FOOBAR', 'bar', 'i;unicode-casemap', 'starts-with', false), - array('FOOBAR', 'FOO', 'i;unicode-casemap', 'ends-with', false), - array('FOOBAR', 'foo', 'i;unicode-casemap', 'ends-with', false), - array('FOOBAR', 'BAR', 'i;unicode-casemap', 'ends-with', true), - array('FOOBAR', 'bar', 'i;unicode-casemap', 'ends-with', true), - ); + return [ + ['FOOBAR', 'FOO', 'i;octet', 'contains', true], + ['FOOBAR', 'foo', 'i;octet', 'contains', false], + ['FÖÖBAR', 'FÖÖ', 'i;octet', 'contains', true], + ['FÖÖBAR', 'föö', 'i;octet', 'contains', false], + ['FOOBAR', 'FOOBAR', 'i;octet', 'equals', true], + ['FOOBAR', 'fooBAR', 'i;octet', 'equals', false], + ['FOOBAR', 'FOO', 'i;octet', 'starts-with', true], + ['FOOBAR', 'foo', 'i;octet', 'starts-with', false], + ['FOOBAR', 'BAR', 'i;octet', 'starts-with', false], + ['FOOBAR', 'bar', 'i;octet', 'starts-with', false], + ['FOOBAR', 'FOO', 'i;octet', 'ends-with', false], + ['FOOBAR', 'foo', 'i;octet', 'ends-with', false], + ['FOOBAR', 'BAR', 'i;octet', 'ends-with', true], + ['FOOBAR', 'bar', 'i;octet', 'ends-with', false], + + ['FOOBAR', 'FOO', 'i;ascii-casemap', 'contains', true], + ['FOOBAR', 'foo', 'i;ascii-casemap', 'contains', true], + ['FÖÖBAR', 'FÖÖ', 'i;ascii-casemap', 'contains', true], + ['FÖÖBAR', 'föö', 'i;ascii-casemap', 'contains', false], + ['FOOBAR', 'FOOBAR', 'i;ascii-casemap', 'equals', true], + ['FOOBAR', 'fooBAR', 'i;ascii-casemap', 'equals', true], + ['FOOBAR', 'FOO', 'i;ascii-casemap', 'starts-with', true], + ['FOOBAR', 'foo', 'i;ascii-casemap', 'starts-with', true], + ['FOOBAR', 'BAR', 'i;ascii-casemap', 'starts-with', false], + ['FOOBAR', 'bar', 'i;ascii-casemap', 'starts-with', false], + ['FOOBAR', 'FOO', 'i;ascii-casemap', 'ends-with', false], + ['FOOBAR', 'foo', 'i;ascii-casemap', 'ends-with', false], + ['FOOBAR', 'BAR', 'i;ascii-casemap', 'ends-with', true], + ['FOOBAR', 'bar', 'i;ascii-casemap', 'ends-with', true], + + ['FOOBAR', 'FOO', 'i;unicode-casemap', 'contains', true], + ['FOOBAR', 'foo', 'i;unicode-casemap', 'contains', true], + ['FÖÖBAR', 'FÖÖ', 'i;unicode-casemap', 'contains', true], + ['FÖÖBAR', 'föö', 'i;unicode-casemap', 'contains', true], + ['FOOBAR', 'FOOBAR', 'i;unicode-casemap', 'equals', true], + ['FOOBAR', 'fooBAR', 'i;unicode-casemap', 'equals', true], + ['FOOBAR', 'FOO', 'i;unicode-casemap', 'starts-with', true], + ['FOOBAR', 'foo', 'i;unicode-casemap', 'starts-with', true], + ['FOOBAR', 'BAR', 'i;unicode-casemap', 'starts-with', false], + ['FOOBAR', 'bar', 'i;unicode-casemap', 'starts-with', false], + ['FOOBAR', 'FOO', 'i;unicode-casemap', 'ends-with', false], + ['FOOBAR', 'foo', 'i;unicode-casemap', 'ends-with', false], + ['FOOBAR', 'BAR', 'i;unicode-casemap', 'ends-with', true], + ['FOOBAR', 'bar', 'i;unicode-casemap', 'ends-with', true], + ]; } /** * @expectedException Sabre\DAV\Exception\BadRequest */ - public function testBadCollation() { + function testBadCollation() { - StringUtil::textMatch('foobar','foo','blabla','contains'); + StringUtil::textMatch('foobar', 'foo', 'blabla', 'contains'); } @@ -77,13 +77,13 @@ class StringUtilTest extends \PHPUnit_Framework_TestCase { /** * @expectedException Sabre\DAV\Exception\BadRequest */ - public function testBadMatchType() { + function testBadMatchType() { - StringUtil::textMatch('foobar','foo','i;octet','booh'); + StringUtil::textMatch('foobar', 'foo', 'i;octet', 'booh'); } - public function testEnsureUTF8_ascii() { + function testEnsureUTF8_ascii() { $inputString = "harkema"; $outputString = "harkema"; @@ -95,7 +95,7 @@ class StringUtilTest extends \PHPUnit_Framework_TestCase { } - public function testEnsureUTF8_latin1() { + function testEnsureUTF8_latin1() { $inputString = "m\xfcnster"; $outputString = "münster"; @@ -107,7 +107,7 @@ class StringUtilTest extends \PHPUnit_Framework_TestCase { } - public function testEnsureUTF8_utf8() { + function testEnsureUTF8_utf8() { $inputString = "m\xc3\xbcnster"; $outputString = "münster"; diff --git a/vendor/sabre/dav/tests/Sabre/DAV/TemporaryFileFilterTest.php b/vendor/sabre/dav/tests/Sabre/DAV/TemporaryFileFilterTest.php index 7122f4a01..6acd6b077 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/TemporaryFileFilterTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/TemporaryFileFilterTest.php @@ -25,7 +25,7 @@ class TemporaryFileFilterTest extends AbstractServer { $this->assertEquals(201, $this->response->status); $this->assertEquals('0', $this->response->getHeader('Content-Length')); - $this->assertEquals('Testing new file',file_get_contents(SABRE_TEMPDIR . '/testput.txt')); + $this->assertEquals('Testing new file', file_get_contents(SABRE_TEMPDIR . '/testput.txt')); } @@ -39,11 +39,11 @@ class TemporaryFileFilterTest extends AbstractServer { $this->assertEquals('', $this->response->body); $this->assertEquals(201, $this->response->status); - $this->assertEquals(array( + $this->assertEquals([ 'X-Sabre-Temp' => ['true'], - ),$this->response->getHeaders()); + ], $this->response->getHeaders()); - $this->assertFalse(file_exists(SABRE_TEMPDIR . '/._testput.txt'),'._testput.txt should not exist in the regular file structure.'); + $this->assertFalse(file_exists(SABRE_TEMPDIR . '/._testput.txt'), '._testput.txt should not exist in the regular file structure.'); } @@ -57,20 +57,20 @@ class TemporaryFileFilterTest extends AbstractServer { $this->assertEquals('', $this->response->body); $this->assertEquals(201, $this->response->status); - $this->assertEquals(array( + $this->assertEquals([ 'X-Sabre-Temp' => ['true'], - ),$this->response->getHeaders()); + ], $this->response->getHeaders()); - $this->assertFalse(file_exists(SABRE_TEMPDIR . '/._testput.txt'),'._testput.txt should not exist in the regular file structure.'); + $this->assertFalse(file_exists(SABRE_TEMPDIR . '/._testput.txt'), '._testput.txt should not exist in the regular file structure.'); $this->server->exec(); $this->assertEquals(412, $this->response->status); - $this->assertEquals(array( + $this->assertEquals([ 'X-Sabre-Temp' => ['true'], 'Content-Type' => ['application/xml; charset=utf-8'], - ),$this->response->getHeaders()); + ], $this->response->getHeaders()); } @@ -83,9 +83,9 @@ class TemporaryFileFilterTest extends AbstractServer { $this->assertEquals('', $this->response->body); $this->assertEquals(201, $this->response->status); - $this->assertEquals(array( + $this->assertEquals([ 'X-Sabre-Temp' => ['true'], - ),$this->response->getHeaders()); + ], $this->response->getHeaders()); $request = new HTTP\Request('GET', '/._testput.txt'); @@ -93,13 +93,13 @@ class TemporaryFileFilterTest extends AbstractServer { $this->server->exec(); $this->assertEquals(200, $this->response->status); - $this->assertEquals(array( - 'X-Sabre-Temp' => ['true'], + $this->assertEquals([ + 'X-Sabre-Temp' => ['true'], 'Content-Length' => [16], - 'Content-Type' => ['application/octet-stream'], - ),$this->response->getHeaders()); + 'Content-Type' => ['application/octet-stream'], + ], $this->response->getHeaders()); - $this->assertEquals('Testing new file',stream_get_contents($this->response->body)); + $this->assertEquals('Testing new file', stream_get_contents($this->response->body)); } @@ -125,11 +125,11 @@ class TemporaryFileFilterTest extends AbstractServer { $this->server->exec(); $this->assertEquals(201, $this->response->status); - $this->assertEquals('application/xml; charset=utf-8',$this->response->getHeader('Content-Type')); - $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/',$this->response->getHeader('Lock-Token'))===1,'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')'); - $this->assertEquals('true',$this->response->getHeader('X-Sabre-Temp')); + $this->assertEquals('application/xml; charset=utf-8', $this->response->getHeader('Content-Type')); + $this->assertTrue(preg_match('/^<opaquelocktoken:(.*)>$/', $this->response->getHeader('Lock-Token')) === 1, 'We did not get a valid Locktoken back (' . $this->response->getHeader('Lock-Token') . ')'); + $this->assertEquals('true', $this->response->getHeader('X-Sabre-Temp')); - $this->assertFalse(file_exists(SABRE_TEMPDIR . '/._testlock.txt'),'._testlock.txt should not exist in the regular file structure.'); + $this->assertFalse(file_exists(SABRE_TEMPDIR . '/._testlock.txt'), '._testlock.txt should not exist in the regular file structure.'); } @@ -143,20 +143,20 @@ class TemporaryFileFilterTest extends AbstractServer { $this->assertEquals('', $this->response->body); $this->assertEquals(201, $this->response->status); - $this->assertEquals(array( + $this->assertEquals([ 'X-Sabre-Temp' => ['true'], - ),$this->response->getHeaders()); + ], $this->response->getHeaders()); $request = new HTTP\Request('DELETE', '/._testput.txt'); $this->server->httpRequest = $request; $this->server->exec(); - $this->assertEquals(204, $this->response->status, "Incorrect status code received. Full body:\n". $this->response->body); - $this->assertEquals(array( + $this->assertEquals(204, $this->response->status, "Incorrect status code received. Full body:\n" . $this->response->body); + $this->assertEquals([ 'X-Sabre-Temp' => ['true'], - ),$this->response->getHeaders()); + ], $this->response->getHeaders()); - $this->assertEquals('',$this->response->body); + $this->assertEquals('', $this->response->body); } @@ -169,30 +169,30 @@ class TemporaryFileFilterTest extends AbstractServer { $this->assertEquals('', $this->response->body); $this->assertEquals(201, $this->response->status); - $this->assertEquals(array( + $this->assertEquals([ 'X-Sabre-Temp' => ['true'], - ),$this->response->getHeaders()); + ], $this->response->getHeaders()); $request = new HTTP\Request('PROPFIND', '/._testput.txt'); $this->server->httpRequest = ($request); $this->server->exec(); - $this->assertEquals(207, $this->response->status,'Incorrect status code returned. Body: ' . $this->response->body); - $this->assertEquals(array( + $this->assertEquals(207, $this->response->status, 'Incorrect status code returned. Body: ' . $this->response->body); + $this->assertEquals([ 'X-Sabre-Temp' => ['true'], 'Content-Type' => ['application/xml; charset=utf-8'], - ),$this->response->getHeaders()); + ], $this->response->getHeaders()); - $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/","xmlns\\1=\"urn:DAV\"",$this->response->body); + $body = preg_replace("/xmlns(:[A-Za-z0-9_])?=(\"|\')DAV:(\"|\')/", "xmlns\\1=\"urn:DAV\"", $this->response->body); $xml = simplexml_load_string($body); - $xml->registerXPathNamespace('d','urn:DAV'); + $xml->registerXPathNamespace('d', 'urn:DAV'); list($data) = $xml->xpath('/d:multistatus/d:response/d:href'); - $this->assertEquals('/._testput.txt',(string)$data,'href element should have been /._testput.txt'); + $this->assertEquals('/._testput.txt', (string)$data, 'href element should have been /._testput.txt'); $data = $xml->xpath('/d:multistatus/d:response/d:propstat/d:prop/d:resourcetype'); - $this->assertEquals(1,count($data)); + $this->assertEquals(1, count($data)); } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/TestPlugin.php b/vendor/sabre/dav/tests/Sabre/DAV/TestPlugin.php index bb5ea6acc..619ac03fd 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/TestPlugin.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/TestPlugin.php @@ -2,9 +2,8 @@ namespace Sabre\DAV; -use - Sabre\HTTP\RequestInterface, - Sabre\HTTP\ResponseInterface; +use Sabre\HTTP\RequestInterface; +use Sabre\HTTP\ResponseInterface; class TestPlugin extends ServerPlugin { @@ -24,7 +23,7 @@ class TestPlugin extends ServerPlugin { function initialize(Server $server) { - $server->on('beforeMethod', [$this,'beforeMethod']); + $server->on('beforeMethod', [$this, 'beforeMethod']); } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/TreeTest.php b/vendor/sabre/dav/tests/Sabre/DAV/TreeTest.php index 9516c2390..ad33200c8 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/TreeTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/TreeTest.php @@ -16,18 +16,18 @@ class TreeTest extends \PHPUnit_Framework_TestCase { function testCopy() { $tree = new TreeMock(); - $tree->copy('hi','hi2'); + $tree->copy('hi', 'hi2'); $this->assertArrayHasKey('hi2', $tree->getNodeForPath('')->newDirectories); $this->assertEquals('foobar', $tree->getNodeForPath('hi/file')->get()); - $this->assertEquals(array('test1'=>'value'), $tree->getNodeForPath('hi/file')->getProperties(array())); + $this->assertEquals(['test1' => 'value'], $tree->getNodeForPath('hi/file')->getProperties([])); } function testMove() { $tree = new TreeMock(); - $tree->move('hi','hi2'); + $tree->move('hi', 'hi2'); $this->assertEquals('hi2', $tree->getNodeForPath('hi')->getName()); $this->assertTrue($tree->getNodeForPath('hi')->isRenamed); @@ -37,7 +37,7 @@ class TreeTest extends \PHPUnit_Framework_TestCase { function testDeepMove() { $tree = new TreeMock(); - $tree->move('hi/sub','hi2'); + $tree->move('hi/sub', 'hi2'); $this->assertArrayHasKey('hi2', $tree->getNodeForPath('')->newDirectories); $this->assertTrue($tree->getNodeForPath('hi/sub')->isDeleted); @@ -56,7 +56,7 @@ class TreeTest extends \PHPUnit_Framework_TestCase { $tree = new TreeMock(); $children = $tree->getChildren(''); - $this->assertEquals(2,count($children)); + $this->assertEquals(2, count($children)); $this->assertEquals('hi', $children[0]->getName()); } @@ -85,12 +85,12 @@ class TreeTest extends \PHPUnit_Framework_TestCase { class TreeMock extends Tree { - private $nodes = array(); + private $nodes = []; function __construct() { $file = new TreeFileTester('file'); - $file->properties = ['test1'=>'value']; + $file->properties = ['test1' => 'value']; $file->data = 'foobar'; parent::__construct( @@ -113,8 +113,8 @@ class TreeMock extends Tree { class TreeDirectoryTester extends SimpleCollection { - public $newDirectories = array(); - public $newFiles = array(); + public $newDirectories = []; + public $newFiles = []; public $isDeleted = false; public $isRenamed = false; @@ -124,7 +124,7 @@ class TreeDirectoryTester extends SimpleCollection { } - function createFile($name,$data = null) { + function createFile($name, $data = null) { $this->newFiles[$name] = $data; @@ -132,7 +132,7 @@ class TreeDirectoryTester extends SimpleCollection { function getChild($name) { - if (isset($this->newDirectories[$name])) return new TreeDirectoryTester($name); + if (isset($this->newDirectories[$name])) return new self($name); if (isset($this->newFiles[$name])) return new TreeFileTester($name, $this->newFiles[$name]); return parent::getChild($name); @@ -225,7 +225,7 @@ class TreeMultiGetTester extends TreeDirectoryTester implements IMultiGet { function getMultipleChildren(array $paths) { $result = []; - foreach($paths as $path) { + foreach ($paths as $path) { try { $child = $this->getChild($path); $result[] = $child; -- cgit v1.2.3 From dcc65bbacb81801b5e138795c18ef9e740dbd26c Mon Sep 17 00:00:00 2001 From: Mario Vavti <mario@mariovavti.com> Date: Tue, 28 Jun 2016 21:45:14 +0200 Subject: update to sabre/dav to version 3.2.0 --- .../dav/tests/Sabre/DAV/Auth/Backend/FileTest.php | 3 +-- vendor/sabre/dav/tests/Sabre/DAV/Auth/PluginTest.php | 19 +++++++++++++++++++ vendor/sabre/dav/tests/Sabre/DAV/ServerEventsTest.php | 4 +++- 3 files changed, 23 insertions(+), 3 deletions(-) (limited to 'vendor/sabre/dav/tests/Sabre/DAV') diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/FileTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/FileTest.php index 9b66d642f..f694f4806 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/FileTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/FileTest.php @@ -23,8 +23,7 @@ class FileTest extends \PHPUnit_Framework_TestCase { function testLoadFileBroken() { file_put_contents(SABRE_TEMPDIR . '/backend', 'user:realm:hash'); - $file = new File(); - $file->loadFile(SABRE_TEMPDIR . '/backend'); + $file = new File(SABRE_TEMPDIR . '/backend'); } diff --git a/vendor/sabre/dav/tests/Sabre/DAV/Auth/PluginTest.php b/vendor/sabre/dav/tests/Sabre/DAV/Auth/PluginTest.php index 3ed79a7da..b566dd757 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/PluginTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/Auth/PluginTest.php @@ -48,6 +48,25 @@ class PluginTest extends \PHPUnit_Framework_TestCase { } + /** + * @depends testAuthenticateFail + */ + function testAuthenticateFailDontAutoRequire() { + + $fakeServer = new DAV\Server(new DAV\SimpleCollection('bla')); + $backend = new Backend\Mock(); + $backend->fail = true; + + $plugin = new Plugin($backend); + $plugin->autoRequireLogin = false; + $fakeServer->addPlugin($plugin); + $this->assertTrue( + $fakeServer->emit('beforeMethod', [new HTTP\Request(), new HTTP\Response()]) + ); + $this->assertEquals(1, count($plugin->getLoginFailedReasons())); + + } + /** * @depends testAuthenticate */ diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ServerEventsTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ServerEventsTest.php index 6ac20d2da..4c576f108 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/ServerEventsTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/ServerEventsTest.php @@ -31,7 +31,9 @@ class ServerEventsTest extends AbstractServer { function testAfterResponse() { - $mock = $this->getMock('stdClass', ['afterResponseCallback']); + $mock = $this->getMockBuilder('stdClass') + ->setMethods(['afterResponseCallback']) + ->getMock(); $mock->expects($this->once())->method('afterResponseCallback'); $this->server->on('afterResponse', [$mock, 'afterResponseCallback']); -- cgit v1.2.3