aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/sabre/dav/tests/Sabre/CardDAV/CardTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/sabre/dav/tests/Sabre/CardDAV/CardTest.php')
-rw-r--r--vendor/sabre/dav/tests/Sabre/CardDAV/CardTest.php132
1 files changed, 59 insertions, 73 deletions
diff --git a/vendor/sabre/dav/tests/Sabre/CardDAV/CardTest.php b/vendor/sabre/dav/tests/Sabre/CardDAV/CardTest.php
index cb7d152c3..41853aa63 100644
--- a/vendor/sabre/dav/tests/Sabre/CardDAV/CardTest.php
+++ b/vendor/sabre/dav/tests/Sabre/CardDAV/CardTest.php
@@ -1,9 +1,11 @@
<?php
-namespace Sabre\CardDAV;
+declare(strict_types=1);
-class CardTest extends \PHPUnit_Framework_TestCase {
+namespace Sabre\CardDAV;
+class CardTest extends \PHPUnit\Framework\TestCase
+{
/**
* @var Sabre\CardDAV\Card
*/
@@ -13,140 +15,128 @@ class CardTest extends \PHPUnit_Framework_TestCase {
*/
protected $backend;
- function setUp() {
-
+ public function setUp()
+ {
$this->backend = new Backend\Mock();
$this->card = new Card(
$this->backend,
[
- 'uri' => 'book1',
- 'id' => 'foo',
+ 'uri' => 'book1',
+ 'id' => 'foo',
'principaluri' => 'principals/user1',
],
[
- 'uri' => 'card1',
+ 'uri' => 'card1',
'addressbookid' => 'foo',
- 'carddata' => 'card',
+ 'carddata' => 'card',
]
);
-
}
- function testGet() {
-
+ public function testGet()
+ {
$result = $this->card->get();
$this->assertEquals('card', $result);
-
}
- function testGet2() {
+ public function testGet2()
+ {
$this->card = new Card(
$this->backend,
[
- 'uri' => 'book1',
- 'id' => 'foo',
+ 'uri' => 'book1',
+ 'id' => 'foo',
'principaluri' => 'principals/user1',
],
[
- 'uri' => 'card1',
+ 'uri' => 'card1',
'addressbookid' => 'foo',
]
);
$result = $this->card->get();
$this->assertEquals("BEGIN:VCARD\nVERSION:3.0\nUID:12345\nEND:VCARD", $result);
-
}
-
/**
* @depends testGet
*/
- function testPut() {
-
+ public function testPut()
+ {
$file = fopen('php://memory', 'r+');
fwrite($file, 'newdata');
rewind($file);
$this->card->put($file);
$result = $this->card->get();
$this->assertEquals('newdata', $result);
-
}
-
- function testDelete() {
-
+ public function testDelete()
+ {
$this->card->delete();
$this->assertEquals(1, count($this->backend->cards['foo']));
-
}
- function testGetContentType() {
-
+ public function testGetContentType()
+ {
$this->assertEquals('text/vcard; charset=utf-8', $this->card->getContentType());
-
}
- function testGetETag() {
-
- $this->assertEquals('"' . md5('card') . '"', $this->card->getETag());
-
+ public function testGetETag()
+ {
+ $this->assertEquals('"'.md5('card').'"', $this->card->getETag());
}
- function testGetETag2() {
-
+ public function testGetETag2()
+ {
$card = new Card(
$this->backend,
[
- 'uri' => 'book1',
- 'id' => 'foo',
+ 'uri' => 'book1',
+ 'id' => 'foo',
'principaluri' => 'principals/user1',
],
[
- 'uri' => 'card1',
+ 'uri' => 'card1',
'addressbookid' => 'foo',
- 'carddata' => 'card',
- 'etag' => '"blabla"',
+ 'carddata' => 'card',
+ 'etag' => '"blabla"',
]
);
$this->assertEquals('"blabla"', $card->getETag());
-
}
- function testGetLastModified() {
-
+ public function testGetLastModified()
+ {
$this->assertEquals(null, $this->card->getLastModified());
-
}
- function testGetSize() {
-
+ public function testGetSize()
+ {
$this->assertEquals(4, $this->card->getSize());
$this->assertEquals(4, $this->card->getSize());
-
}
- function testGetSize2() {
-
+ public function testGetSize2()
+ {
$card = new Card(
$this->backend,
[
- 'uri' => 'book1',
- 'id' => 'foo',
+ 'uri' => 'book1',
+ 'id' => 'foo',
'principaluri' => 'principals/user1',
],
[
- 'uri' => 'card1',
+ 'uri' => 'card1',
'addressbookid' => 'foo',
- 'etag' => '"blabla"',
- 'size' => 4,
+ 'etag' => '"blabla"',
+ 'size' => 4,
]
);
$this->assertEquals(4, $card->getSize());
-
}
- function testACLMethods() {
-
+ public function testACLMethods()
+ {
$this->assertEquals('principals/user1', $this->card->getOwner());
$this->assertNull($this->card->getGroup());
$this->assertEquals([
@@ -156,22 +146,22 @@ class CardTest extends \PHPUnit_Framework_TestCase {
'protected' => true,
],
], $this->card->getACL());
-
}
- function testOverrideACL() {
+ public function testOverrideACL()
+ {
$card = new Card(
$this->backend,
[
- 'uri' => 'book1',
- 'id' => 'foo',
+ 'uri' => 'book1',
+ 'id' => 'foo',
'principaluri' => 'principals/user1',
],
[
- 'uri' => 'card1',
+ 'uri' => 'card1',
'addressbookid' => 'foo',
- 'carddata' => 'card',
- 'acl' => [
+ 'carddata' => 'card',
+ 'acl' => [
[
'privilege' => '{DAV:}read',
'principal' => 'principals/user1',
@@ -187,24 +177,20 @@ class CardTest extends \PHPUnit_Framework_TestCase {
'protected' => true,
],
], $card->getACL());
-
}
/**
- * @expectedException Sabre\DAV\Exception\Forbidden
+ * @expectedException \Sabre\DAV\Exception\Forbidden
*/
- function testSetACL() {
-
- $this->card->setACL([]);
-
+ public function testSetACL()
+ {
+ $this->card->setACL([]);
}
- function testGetSupportedPrivilegeSet() {
-
+ public function testGetSupportedPrivilegeSet()
+ {
$this->assertNull(
$this->card->getSupportedPrivilegeSet()
);
-
}
-
}