aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/dav/tests/Sabre/DAV/Auth
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/DAV/Auth')
-rw-r--r--vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractBasicTest.php59
-rw-r--r--vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractDigestTest.php84
-rw-r--r--vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractPDOTest.php23
-rw-r--r--vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/ApacheTest.php39
-rw-r--r--vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/FileTest.php41
-rw-r--r--vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/Mock.php30
-rw-r--r--vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/PDOMySQLTest.php7
-rw-r--r--vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/PDOSqliteTest.php7
-rw-r--r--vendor/sabre/dav/tests/Sabre/DAV/Auth/PluginTest.php68
9 files changed, 174 insertions, 184 deletions
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 917f5ec3f..ebc1e3f7b 100644
--- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractBasicTest.php
+++ b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractBasicTest.php
@@ -1,14 +1,16 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\DAV\Auth\Backend;
use Sabre\HTTP;
-class AbstractBasicTest extends \PHPUnit_Framework_TestCase {
-
- function testCheckNoHeaders() {
-
- $request = new HTTP\Request();
+class AbstractBasicTest extends \PHPUnit\Framework\TestCase
+{
+ public function testCheckNoHeaders()
+ {
+ $request = new HTTP\Request('GET', '/');
$response = new HTTP\Response();
$backend = new AbstractBasicMock();
@@ -16,14 +18,15 @@ class AbstractBasicTest extends \PHPUnit_Framework_TestCase {
$this->assertFalse(
$backend->check($request, $response)[0]
);
-
}
- function testCheckUnknownUser() {
-
+ public function testCheckUnknownUser()
+ {
$request = HTTP\Sapi::createFromServerArray([
+ 'REQUEST_METHOD' => 'GET',
+ 'REQUEST_URI' => '/',
'PHP_AUTH_USER' => 'username',
- 'PHP_AUTH_PW' => 'wrongpassword',
+ 'PHP_AUTH_PW' => 'wrongpassword',
]);
$response = new HTTP\Response();
@@ -32,14 +35,15 @@ class AbstractBasicTest extends \PHPUnit_Framework_TestCase {
$this->assertFalse(
$backend->check($request, $response)[0]
);
-
}
- function testCheckSuccess() {
-
+ public function testCheckSuccess()
+ {
$request = HTTP\Sapi::createFromServerArray([
+ 'REQUEST_METHOD' => 'GET',
+ 'REQUEST_URI' => '/',
'PHP_AUTH_USER' => 'username',
- 'PHP_AUTH_PW' => 'password',
+ 'PHP_AUTH_PW' => 'password',
]);
$response = new HTTP\Response();
@@ -48,44 +52,39 @@ class AbstractBasicTest extends \PHPUnit_Framework_TestCase {
[true, 'principals/username'],
$backend->check($request, $response)
);
-
}
- function testRequireAuth() {
-
- $request = new HTTP\Request();
+ public function testRequireAuth()
+ {
+ $request = new HTTP\Request('GET', '/');
$response = new HTTP\Response();
$backend = new AbstractBasicMock();
$backend->setRealm('writing unittests on a saturday night');
$backend->challenge($request, $response);
- $this->assertContains(
- 'Basic realm="writing unittests on a saturday night"',
+ $this->assertEquals(
+ 'Basic realm="writing unittests on a saturday night", charset="UTF-8"',
$response->getHeader('WWW-Authenticate')
);
-
}
-
}
-
-class AbstractBasicMock extends AbstractBasic {
-
+class AbstractBasicMock extends AbstractBasic
+{
/**
- * Validates a username and password
+ * Validates a username and password.
*
* This method should return true or false depending on if login
* succeeded.
*
* @param string $username
* @param string $password
+ *
* @return bool
*/
- function validateUserPass($username, $password) {
-
- return ($username == 'username' && $password == 'password');
-
+ public function validateUserPass($username, $password)
+ {
+ return 'username' == $username && 'password' == $password;
}
-
}
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 14c72aaa0..d9af326fe 100644
--- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractDigestTest.php
+++ b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractDigestTest.php
@@ -1,27 +1,30 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\DAV\Auth\Backend;
use Sabre\HTTP;
-class AbstractDigestTest extends \PHPUnit_Framework_TestCase {
-
- function testCheckNoHeaders() {
-
- $request = new HTTP\Request();
+class AbstractDigestTest extends \PHPUnit\Framework\TestCase
+{
+ public function testCheckNoHeaders()
+ {
+ $request = new HTTP\Request('GET', '/');
$response = new HTTP\Response();
$backend = new AbstractDigestMock();
$this->assertFalse(
$backend->check($request, $response)[0]
);
-
}
- function testCheckBadGetUserInfoResponse() {
-
+ public function testCheckBadGetUserInfoResponse()
+ {
$header = 'username=null, realm=myRealm, nonce=12345, uri=/, response=HASH, opaque=1, qop=auth, nc=1, cnonce=1';
$request = HTTP\Sapi::createFromServerArray([
+ 'REQUEST_METHOD' => 'GET',
+ 'REQUEST_URI' => '/',
'PHP_AUTH_DIGEST' => $header,
]);
$response = new HTTP\Response();
@@ -30,16 +33,17 @@ class AbstractDigestTest extends \PHPUnit_Framework_TestCase {
$this->assertFalse(
$backend->check($request, $response)[0]
);
-
}
/**
- * @expectedException Sabre\DAV\Exception
+ * @expectedException \Sabre\DAV\Exception
*/
- function testCheckBadGetUserInfoResponse2() {
-
+ public function testCheckBadGetUserInfoResponse2()
+ {
$header = 'username=array, realm=myRealm, nonce=12345, uri=/, response=HASH, opaque=1, qop=auth, nc=1, cnonce=1';
$request = HTTP\Sapi::createFromServerArray([
+ 'REQUEST_METHOD' => 'GET',
+ 'REQUEST_URI' => '/',
'PHP_AUTH_DIGEST' => $header,
]);
@@ -47,13 +51,14 @@ class AbstractDigestTest extends \PHPUnit_Framework_TestCase {
$backend = new AbstractDigestMock();
$backend->check($request, $response);
-
}
- function testCheckUnknownUser() {
-
+ public function testCheckUnknownUser()
+ {
$header = 'username=false, realm=myRealm, nonce=12345, uri=/, response=HASH, opaque=1, qop=auth, nc=1, cnonce=1';
$request = HTTP\Sapi::createFromServerArray([
+ 'REQUEST_METHOD' => 'GET',
+ 'REQUEST_URI' => '/',
'PHP_AUTH_DIGEST' => $header,
]);
@@ -63,15 +68,15 @@ class AbstractDigestTest extends \PHPUnit_Framework_TestCase {
$this->assertFalse(
$backend->check($request, $response)[0]
);
-
}
- function testCheckBadPassword() {
-
+ public function testCheckBadPassword()
+ {
$header = 'username=user, realm=myRealm, nonce=12345, uri=/, response=HASH, opaque=1, qop=auth, nc=1, cnonce=1';
$request = HTTP\Sapi::createFromServerArray([
+ 'REQUEST_METHOD' => 'PUT',
+ 'REQUEST_URI' => '/',
'PHP_AUTH_DIGEST' => $header,
- 'REQUEST_METHOD' => 'PUT',
]);
$response = new HTTP\Response();
@@ -80,17 +85,16 @@ class AbstractDigestTest extends \PHPUnit_Framework_TestCase {
$this->assertFalse(
$backend->check($request, $response)[0]
);
-
}
- 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';
+ public 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([
- 'REQUEST_METHOD' => 'GET',
+ 'REQUEST_METHOD' => 'GET',
+ 'REQUEST_URI' => '/',
'PHP_AUTH_DIGEST' => $header,
- 'REQUEST_URI' => '/',
]);
$response = new HTTP\Response();
@@ -100,12 +104,11 @@ class AbstractDigestTest extends \PHPUnit_Framework_TestCase {
[true, 'principals/user'],
$backend->check($request, $response)
);
-
}
- function testRequireAuth() {
-
- $request = new HTTP\Request();
+ public function testRequireAuth()
+ {
+ $request = new HTTP\Request('GET', '/');
$response = new HTTP\Response();
$backend = new AbstractDigestMock();
@@ -116,23 +119,18 @@ class AbstractDigestTest extends \PHPUnit_Framework_TestCase {
'Digest realm="writing unittests on a saturday night"',
$response->getHeader('WWW-Authenticate')
);
-
}
-
}
-
-class AbstractDigestMock extends AbstractDigest {
-
- function getDigestHash($realm, $userName) {
-
+class AbstractDigestMock extends AbstractDigest
+{
+ public function getDigestHash($realm, $userName)
+ {
switch ($userName) {
- case 'null' : return null;
- case 'false' : return false;
- case 'array' : return [];
- case 'user' : return 'HELLO';
+ case 'null': return null;
+ case 'false': return false;
+ 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 b14e9fa2e..5e34f9c49 100644
--- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractPDOTest.php
+++ b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/AbstractPDOTest.php
@@ -1,36 +1,35 @@
<?php
-namespace Sabre\DAV\Auth\Backend;
+declare(strict_types=1);
-abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
+namespace Sabre\DAV\Auth\Backend;
+abstract class AbstractPDOTest extends \PHPUnit\Framework\TestCase
+{
use \Sabre\DAV\DbTestHelperTrait;
- function setUp() {
-
+ public function setUp()
+ {
$this->dropTables('users');
$this->createSchema('users');
$this->getPDO()->query(
"INSERT INTO users (username,digesta1) VALUES ('user','hash')"
-
);
-
}
- function testConstruct() {
-
+ public function testConstruct()
+ {
$pdo = $this->getPDO();
$backend = new PDO($pdo);
$this->assertTrue($backend instanceof PDO);
-
}
/**
* @depends testConstruct
*/
- function testUserInfo() {
-
+ public function testUserInfo()
+ {
$pdo = $this->getPDO();
$backend = new PDO($pdo);
@@ -39,7 +38,5 @@ abstract class AbstractPDOTest extends \PHPUnit_Framework_TestCase {
$expected = 'hash';
$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 29cbc2162..a0086518f 100644
--- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/ApacheTest.php
+++ b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/ApacheTest.php
@@ -1,33 +1,35 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\DAV\Auth\Backend;
use Sabre\HTTP;
-class ApacheTest extends \PHPUnit_Framework_TestCase {
-
- function testConstruct() {
-
+class ApacheTest extends \PHPUnit\Framework\TestCase
+{
+ public function testConstruct()
+ {
$backend = new Apache();
$this->assertInstanceOf('Sabre\DAV\Auth\Backend\Apache', $backend);
-
}
- function testNoHeader() {
-
- $request = new HTTP\Request();
+ public function testNoHeader()
+ {
+ $request = new HTTP\Request('GET', '/');
$response = new HTTP\Response();
$backend = new Apache();
$this->assertFalse(
$backend->check($request, $response)[0]
);
-
}
- function testRemoteUser() {
-
+ public function testRemoteUser()
+ {
$request = HTTP\Sapi::createFromServerArray([
+ 'REQUEST_METHOD' => 'GET',
+ 'REQUEST_URI' => '/',
'REMOTE_USER' => 'username',
]);
$response = new HTTP\Response();
@@ -37,12 +39,13 @@ class ApacheTest extends \PHPUnit_Framework_TestCase {
[true, 'principals/username'],
$backend->check($request, $response)
);
-
}
- function testRedirectRemoteUser() {
-
+ public function testRedirectRemoteUser()
+ {
$request = HTTP\Sapi::createFromServerArray([
+ 'REQUEST_METHOD' => 'GET',
+ 'REQUEST_URI' => '/',
'REDIRECT_REMOTE_USER' => 'username',
]);
$response = new HTTP\Response();
@@ -52,12 +55,11 @@ class ApacheTest extends \PHPUnit_Framework_TestCase {
[true, 'principals/username'],
$backend->check($request, $response)
);
-
}
- function testRequireAuth() {
-
- $request = new HTTP\Request();
+ public function testRequireAuth()
+ {
+ $request = new HTTP\Request('GET', '/');
$response = new HTTP\Response();
$backend = new Apache();
@@ -66,6 +68,5 @@ class ApacheTest extends \PHPUnit_Framework_TestCase {
$this->assertNull(
$response->getHeader('WWW-Authenticate')
);
-
}
}
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 f694f4806..0297b17f9 100644
--- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/FileTest.php
+++ b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/FileTest.php
@@ -1,41 +1,40 @@
<?php
-namespace Sabre\DAV\Auth\Backend;
-
-class FileTest extends \PHPUnit_Framework_TestCase {
-
- function tearDown() {
+declare(strict_types=1);
- if (file_exists(SABRE_TEMPDIR . '/filebackend')) unlink(SABRE_TEMPDIR . '/filebackend');
+namespace Sabre\DAV\Auth\Backend;
+class FileTest extends \PHPUnit\Framework\TestCase
+{
+ public function tearDown()
+ {
+ if (file_exists(SABRE_TEMPDIR.'/filebackend')) {
+ unlink(SABRE_TEMPDIR.'/filebackend');
+ }
}
- function testConstruct() {
-
+ public function testConstruct()
+ {
$file = new File();
$this->assertTrue($file instanceof File);
-
}
/**
- * @expectedException Sabre\DAV\Exception
+ * @expectedException \Sabre\DAV\Exception
*/
- function testLoadFileBroken() {
-
- file_put_contents(SABRE_TEMPDIR . '/backend', 'user:realm:hash');
- $file = new File(SABRE_TEMPDIR . '/backend');
-
+ public function testLoadFileBroken()
+ {
+ file_put_contents(SABRE_TEMPDIR.'/backend', 'user:realm:hash');
+ $file = new File(SABRE_TEMPDIR.'/backend');
}
- function testLoadFile() {
-
- file_put_contents(SABRE_TEMPDIR . '/backend', 'user:realm:' . md5('user:realm:password'));
+ public function testLoadFile()
+ {
+ file_put_contents(SABRE_TEMPDIR.'/backend', 'user:realm:'.md5('user:realm:password'));
$file = new File();
- $file->loadFile(SABRE_TEMPDIR . '/backend');
+ $file->loadFile(SABRE_TEMPDIR.'/backend');
$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 369bc249e..730f2a975 100644
--- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/Mock.php
+++ b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/Mock.php
@@ -1,22 +1,23 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\DAV\Auth\Backend;
use Sabre\HTTP\RequestInterface;
use Sabre\HTTP\ResponseInterface;
-class Mock implements BackendInterface {
-
+class Mock implements BackendInterface
+{
public $fail = false;
public $invalidCheckResponse = false;
public $principal = 'principals/admin';
- function setPrincipal($principal) {
-
+ public function setPrincipal($principal)
+ {
$this->principal = $principal;
-
}
/**
@@ -43,20 +44,21 @@ class Mock implements BackendInterface {
*
* principals/users/[username]
*
- * @param RequestInterface $request
+ * @param RequestInterface $request
* @param ResponseInterface $response
+ *
* @return array
*/
- function check(RequestInterface $request, ResponseInterface $response) {
-
+ public function check(RequestInterface $request, ResponseInterface $response)
+ {
if ($this->invalidCheckResponse) {
return 'incorrect!';
}
if ($this->fail) {
- return [false, "fail!"];
+ return [false, 'fail!'];
}
- return [true, $this->principal];
+ return [true, $this->principal];
}
/**
@@ -76,12 +78,10 @@ class Mock implements BackendInterface {
* append your own WWW-Authenticate header instead of overwriting the
* existing one.
*
- * @param RequestInterface $request
+ * @param RequestInterface $request
* @param ResponseInterface $response
- * @return void
*/
- function challenge(RequestInterface $request, ResponseInterface $response) {
-
+ public function challenge(RequestInterface $request, ResponseInterface $response)
+ {
}
-
}
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 18f59793a..6ad7906c4 100644
--- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/PDOMySQLTest.php
+++ b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/PDOMySQLTest.php
@@ -1,9 +1,10 @@
<?php
-namespace Sabre\DAV\Auth\Backend;
+declare(strict_types=1);
-class PDOMySQLTest extends AbstractPDOTest {
+namespace Sabre\DAV\Auth\Backend;
+class PDOMySQLTest extends AbstractPDOTest
+{
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 b1f382237..b42b40eff 100644
--- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/PDOSqliteTest.php
+++ b/vendor/sabre/dav/tests/Sabre/DAV/Auth/Backend/PDOSqliteTest.php
@@ -1,9 +1,10 @@
<?php
-namespace Sabre\DAV\Auth\Backend;
+declare(strict_types=1);
-class PDOSqliteTest extends AbstractPDOTest {
+namespace Sabre\DAV\Auth\Backend;
+class PDOSqliteTest extends AbstractPDOTest
+{
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 743446127..03c8a4624 100644
--- a/vendor/sabre/dav/tests/Sabre/DAV/Auth/PluginTest.php
+++ b/vendor/sabre/dav/tests/Sabre/DAV/Auth/PluginTest.php
@@ -1,58 +1,57 @@
<?php
+declare(strict_types=1);
+
namespace Sabre\DAV\Auth;
use Sabre\DAV;
use Sabre\HTTP;
-class PluginTest extends \PHPUnit_Framework_TestCase {
-
- function testInit() {
-
+class PluginTest extends \PHPUnit\Framework\TestCase
+{
+ public function testInit()
+ {
$fakeServer = new DAV\Server(new DAV\SimpleCollection('bla'));
$plugin = new Plugin(new Backend\Mock());
$this->assertTrue($plugin instanceof Plugin);
$fakeServer->addPlugin($plugin);
$this->assertEquals($plugin, $fakeServer->getPlugin('auth'));
$this->assertInternalType('array', $plugin->getPluginInfo());
-
}
/**
* @depends testInit
*/
- function testAuthenticate() {
-
+ public function testAuthenticate()
+ {
$fakeServer = new DAV\Server(new DAV\SimpleCollection('bla'));
$plugin = new Plugin(new Backend\Mock());
$fakeServer->addPlugin($plugin);
$this->assertTrue(
- $fakeServer->emit('beforeMethod', [new HTTP\Request(), new HTTP\Response()])
+ $fakeServer->emit('beforeMethod:GET', [new HTTP\Request('GET', '/'), new HTTP\Response()])
);
-
}
/**
* @depends testInit
- * @expectedException Sabre\DAV\Exception\NotAuthenticated
+ * @expectedException \Sabre\DAV\Exception\NotAuthenticated
*/
- function testAuthenticateFail() {
-
+ public function testAuthenticateFail()
+ {
$fakeServer = new DAV\Server(new DAV\SimpleCollection('bla'));
$backend = new Backend\Mock();
$backend->fail = true;
$plugin = new Plugin($backend);
$fakeServer->addPlugin($plugin);
- $fakeServer->emit('beforeMethod', [new HTTP\Request(), new HTTP\Response()]);
-
+ $fakeServer->emit('beforeMethod:GET', [new HTTP\Request('GET', '/'), new HTTP\Response()]);
}
/**
* @depends testAuthenticateFail
*/
- function testAuthenticateFailDontAutoRequire() {
-
+ public function testAuthenticateFailDontAutoRequire()
+ {
$fakeServer = new DAV\Server(new DAV\SimpleCollection('bla'));
$backend = new Backend\Mock();
$backend->fail = true;
@@ -61,17 +60,16 @@ class PluginTest extends \PHPUnit_Framework_TestCase {
$plugin->autoRequireLogin = false;
$fakeServer->addPlugin($plugin);
$this->assertTrue(
- $fakeServer->emit('beforeMethod', [new HTTP\Request(), new HTTP\Response()])
+ $fakeServer->emit('beforeMethod:GET', [new HTTP\Request('GET', '/'), new HTTP\Response()])
);
$this->assertEquals(1, count($plugin->getLoginFailedReasons()));
-
}
/**
* @depends testAuthenticate
*/
- function testMultipleBackend() {
-
+ public function testMultipleBackend()
+ {
$fakeServer = new DAV\Server(new DAV\SimpleCollection('bla'));
$backend1 = new Backend\Mock();
$backend2 = new Backend\Mock();
@@ -82,52 +80,48 @@ class PluginTest extends \PHPUnit_Framework_TestCase {
$plugin->addBackend($backend2);
$fakeServer->addPlugin($plugin);
- $fakeServer->emit('beforeMethod', [new HTTP\Request(), new HTTP\Response()]);
+ $fakeServer->emit('beforeMethod:GET', [new HTTP\Request('GET', '/'), new HTTP\Response()]);
$this->assertEquals('principals/admin', $plugin->getCurrentPrincipal());
-
}
/**
* @depends testInit
- * @expectedException Sabre\DAV\Exception
+ * @expectedException \Sabre\DAV\Exception
*/
- function testNoAuthBackend() {
-
+ public function testNoAuthBackend()
+ {
$fakeServer = new DAV\Server(new DAV\SimpleCollection('bla'));
$plugin = new Plugin();
$fakeServer->addPlugin($plugin);
- $fakeServer->emit('beforeMethod', [new HTTP\Request(), new HTTP\Response()]);
-
+ $fakeServer->emit('beforeMethod:GET', [new HTTP\Request('GET', '/'), new HTTP\Response()]);
}
+
/**
* @depends testInit
- * @expectedException Sabre\DAV\Exception
+ * @expectedException \Sabre\DAV\Exception
*/
- function testInvalidCheckResponse() {
-
+ public function testInvalidCheckResponse()
+ {
$fakeServer = new DAV\Server(new DAV\SimpleCollection('bla'));
$backend = new Backend\Mock();
$backend->invalidCheckResponse = true;
$plugin = new Plugin($backend);
$fakeServer->addPlugin($plugin);
- $fakeServer->emit('beforeMethod', [new HTTP\Request(), new HTTP\Response()]);
-
+ $fakeServer->emit('beforeMethod:GET', [new HTTP\Request('GET', '/'), new HTTP\Response()]);
}
/**
* @depends testAuthenticate
*/
- function testGetCurrentPrincipal() {
-
+ public function testGetCurrentPrincipal()
+ {
$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()]);
+ $fakeServer->emit('beforeMethod:GET', [new HTTP\Request('GET', '/'), new HTTP\Response()]);
$this->assertEquals('principals/admin', $plugin->getCurrentPrincipal());
-
}
-
}