diff options
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/DAV/ClientTest.php')
-rw-r--r-- | vendor/sabre/dav/tests/Sabre/DAV/ClientTest.php | 127 |
1 files changed, 56 insertions, 71 deletions
diff --git a/vendor/sabre/dav/tests/Sabre/DAV/ClientTest.php b/vendor/sabre/dav/tests/Sabre/DAV/ClientTest.php index 687f61e2f..e9362c8e4 100644 --- a/vendor/sabre/dav/tests/Sabre/DAV/ClientTest.php +++ b/vendor/sabre/dav/tests/Sabre/DAV/ClientTest.php @@ -1,119 +1,111 @@ <?php +declare(strict_types=1); + namespace Sabre\DAV; -use Sabre\HTTP\Request; use Sabre\HTTP\Response; require_once 'Sabre/DAV/ClientMock.php'; -class ClientTest extends \PHPUnit_Framework_TestCase { - - function setUp() { - +class ClientTest extends \PHPUnit\Framework\TestCase +{ + public function setUp() + { if (!function_exists('curl_init')) { $this->markTestSkipped('CURL must be installed to test the client'); } - } - function testConstruct() { - + public function testConstruct() + { $client = new ClientMock([ 'baseUri' => '/', ]); $this->assertInstanceOf('Sabre\DAV\ClientMock', $client); - } /** - * @expectedException InvalidArgumentException + * @expectedException \InvalidArgumentException */ - function testConstructNoBaseUri() { - + public function testConstructNoBaseUri() + { $client = new ClientMock([]); - } - function testAuth() { - + public function testAuth() + { $client = new ClientMock([ - 'baseUri' => '/', + 'baseUri' => '/', 'userName' => 'foo', 'password' => 'bar', ]); - $this->assertEquals("foo:bar", $client->curlSettings[CURLOPT_USERPWD]); + $this->assertEquals('foo:bar', $client->curlSettings[CURLOPT_USERPWD]); $this->assertEquals(CURLAUTH_BASIC | CURLAUTH_DIGEST, $client->curlSettings[CURLOPT_HTTPAUTH]); - } - function testBasicAuth() { - + public function testBasicAuth() + { $client = new ClientMock([ - 'baseUri' => '/', + 'baseUri' => '/', 'userName' => 'foo', 'password' => 'bar', - 'authType' => Client::AUTH_BASIC + 'authType' => Client::AUTH_BASIC, ]); - $this->assertEquals("foo:bar", $client->curlSettings[CURLOPT_USERPWD]); + $this->assertEquals('foo:bar', $client->curlSettings[CURLOPT_USERPWD]); $this->assertEquals(CURLAUTH_BASIC, $client->curlSettings[CURLOPT_HTTPAUTH]); - } - function testDigestAuth() { - + public function testDigestAuth() + { $client = new ClientMock([ - 'baseUri' => '/', + 'baseUri' => '/', 'userName' => 'foo', 'password' => 'bar', - 'authType' => Client::AUTH_DIGEST + 'authType' => Client::AUTH_DIGEST, ]); - $this->assertEquals("foo:bar", $client->curlSettings[CURLOPT_USERPWD]); + $this->assertEquals('foo:bar', $client->curlSettings[CURLOPT_USERPWD]); $this->assertEquals(CURLAUTH_DIGEST, $client->curlSettings[CURLOPT_HTTPAUTH]); - } - function testNTLMAuth() { - + public function testNTLMAuth() + { $client = new ClientMock([ - 'baseUri' => '/', + 'baseUri' => '/', 'userName' => 'foo', 'password' => 'bar', - 'authType' => Client::AUTH_NTLM + 'authType' => Client::AUTH_NTLM, ]); - $this->assertEquals("foo:bar", $client->curlSettings[CURLOPT_USERPWD]); + $this->assertEquals('foo:bar', $client->curlSettings[CURLOPT_USERPWD]); $this->assertEquals(CURLAUTH_NTLM, $client->curlSettings[CURLOPT_HTTPAUTH]); - } - function testProxy() { - + public function testProxy() + { $client = new ClientMock([ 'baseUri' => '/', - 'proxy' => 'localhost:8888', + 'proxy' => 'localhost:8888', ]); - $this->assertEquals("localhost:8888", $client->curlSettings[CURLOPT_PROXY]); - + $this->assertEquals('localhost:8888', $client->curlSettings[CURLOPT_PROXY]); } - function testEncoding() { - + public function testEncoding() + { $client = new ClientMock([ - 'baseUri' => '/', + 'baseUri' => '/', 'encoding' => Client::ENCODING_IDENTITY | Client::ENCODING_GZIP | Client::ENCODING_DEFLATE, ]); - $this->assertEquals("identity,deflate,gzip", $client->curlSettings[CURLOPT_ENCODING]); - + $this->assertEquals('identity,deflate,gzip', $client->curlSettings[CURLOPT_ENCODING]); } - function testPropFind() { - + public function testPropFind() + { $client = new ClientMock([ 'baseUri' => '/', ]); @@ -142,28 +134,26 @@ XML; $this->assertEquals('PROPFIND', $request->getMethod()); $this->assertEquals('/foo', $request->getUrl()); $this->assertEquals([ - 'Depth' => ['0'], + 'Depth' => ['0'], 'Content-Type' => ['application/xml'], ], $request->getHeaders()); - } /** * @expectedException \Sabre\HTTP\ClientHttpException */ - function testPropFindError() { - + public function testPropFindError() + { $client = new ClientMock([ 'baseUri' => '/', ]); $client->response = new Response(405, []); $client->propFind('foo', ['{DAV:}displayname', '{urn:zim}gir']); - } - function testPropFindDepth1() { - + public function testPropFindDepth1() + { $client = new ClientMock([ 'baseUri' => '/', ]); @@ -188,7 +178,7 @@ XML; $this->assertEquals([ '/foo' => [ - '{DAV:}displayname' => 'bar' + '{DAV:}displayname' => 'bar', ], ], $result); @@ -196,14 +186,13 @@ XML; $this->assertEquals('PROPFIND', $request->getMethod()); $this->assertEquals('/foo', $request->getUrl()); $this->assertEquals([ - 'Depth' => ['1'], + 'Depth' => ['1'], 'Content-Type' => ['application/xml'], ], $request->getHeaders()); - } - function testPropPatch() { - + public function testPropPatch() + { $client = new ClientMock([ 'baseUri' => '/', ]); @@ -232,30 +221,28 @@ XML; $this->assertEquals([ 'Content-Type' => ['application/xml'], ], $request->getHeaders()); - } /** * @depends testPropPatch * @expectedException \Sabre\HTTP\ClientHttpException */ - function testPropPatchHTTPError() { - + public function testPropPatchHTTPError() + { $client = new ClientMock([ 'baseUri' => '/', ]); $client->response = new Response(403, [], ''); $client->propPatch('foo', ['{DAV:}displayname' => 'hi', '{urn:zim}gir' => null]); - } /** * @depends testPropPatch - * @expectedException Sabre\HTTP\ClientException + * @expectedException \Sabre\HTTP\ClientException */ - function testPropPatchMultiStatusError() { - + public function testPropPatchMultiStatusError() + { $client = new ClientMock([ 'baseUri' => '/', ]); @@ -277,11 +264,10 @@ XML; $client->response = new Response(207, [], $responseBody); $client->propPatch('foo', ['{DAV:}displayname' => 'hi', '{urn:zim}gir' => null]); - } - function testOPTIONS() { - + public function testOPTIONS() + { $client = new ClientMock([ 'baseUri' => '/', ]); @@ -301,6 +287,5 @@ XML; $this->assertEquals('/', $request->getUrl()); $this->assertEquals([ ], $request->getHeaders()); - } } |