summaryrefslogtreecommitdiffstats
path: root/apps/dav/tests/unit/CardDAV/AddressBookImplTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/dav/tests/unit/CardDAV/AddressBookImplTest.php')
-rw-r--r--apps/dav/tests/unit/CardDAV/AddressBookImplTest.php28
1 files changed, 13 insertions, 15 deletions
diff --git a/apps/dav/tests/unit/CardDAV/AddressBookImplTest.php b/apps/dav/tests/unit/CardDAV/AddressBookImplTest.php
index fa3cae27dec..172b341bd79 100644
--- a/apps/dav/tests/unit/CardDAV/AddressBookImplTest.php
+++ b/apps/dav/tests/unit/CardDAV/AddressBookImplTest.php
@@ -31,6 +31,7 @@ namespace OCA\DAV\Tests\unit\CardDAV;
use OCA\DAV\CardDAV\AddressBook;
use OCA\DAV\CardDAV\AddressBookImpl;
use OCA\DAV\CardDAV\CardDavBackend;
+use OCP\IURLGenerator;
use Sabre\VObject\Component\VCard;
use Sabre\VObject\Property\Text;
use Test\TestCase;
@@ -46,7 +47,7 @@ class AddressBookImplTest extends TestCase {
/** @var AddressBook | \PHPUnit_Framework_MockObject_MockObject */
private $addressBook;
- /** @var \OCP\IURLGenerator | \PHPUnit_Framework_MockObject_MockObject */
+ /** @var IURLGenerator | \PHPUnit_Framework_MockObject_MockObject */
private $urlGenerator;
/** @var CardDavBackend | \PHPUnit_Framework_MockObject_MockObject */
@@ -64,16 +65,12 @@ class AddressBookImplTest extends TestCase {
'principaluri' => 'principals/system/system',
'{DAV:}displayname' => 'display name',
];
- $this->addressBook = $this->getMockBuilder('OCA\DAV\CardDAV\AddressBook')
+ $this->addressBook = $this->getMockBuilder(AddressBook::class)
->disableOriginalConstructor()->getMock();
- $this->backend = $this->getMockBuilder('\OCA\DAV\CardDAV\CardDavBackend')
+ $this->backend = $this->getMockBuilder(CardDavBackend::class)
->disableOriginalConstructor()->getMock();
- $this->vCard = $this->getMockBuilder('Sabre\VObject\Component\VCard')
- ->disableOriginalConstructor()
- ->getMock();
- $this->urlGenerator = $this->getMockBuilder('OCP\IURLGenerator')
- ->disableOriginalConstructor()
- ->getMock();
+ $this->vCard = $this->createMock(VCard::class);
+ $this->urlGenerator = $this->createMock(IURLGenerator::class);
$this->addressBookImpl = new AddressBookImpl(
$this->addressBook,
@@ -96,7 +93,7 @@ class AddressBookImplTest extends TestCase {
public function testSearch() {
/** @var \PHPUnit_Framework_MockObject_MockObject | AddressBookImpl $addressBookImpl */
- $addressBookImpl = $this->getMockBuilder('OCA\DAV\CardDAV\AddressBookImpl')
+ $addressBookImpl = $this->getMockBuilder(AddressBookImpl::class)
->setConstructorArgs(
[
$this->addressBook,
@@ -143,7 +140,7 @@ class AddressBookImplTest extends TestCase {
$uid = 'uid';
/** @var \PHPUnit_Framework_MockObject_MockObject | AddressBookImpl $addressBookImpl */
- $addressBookImpl = $this->getMockBuilder('OCA\DAV\CardDAV\AddressBookImpl')
+ $addressBookImpl = $this->getMockBuilder(AddressBookImpl::class)
->setConstructorArgs(
[
$this->addressBook,
@@ -184,7 +181,7 @@ class AddressBookImplTest extends TestCase {
$properties = ['URI' => $uri, 'UID' => $uid, 'FN' => 'John Doe'];
/** @var \PHPUnit_Framework_MockObject_MockObject | AddressBookImpl $addressBookImpl */
- $addressBookImpl = $this->getMockBuilder('OCA\DAV\CardDAV\AddressBookImpl')
+ $addressBookImpl = $this->getMockBuilder(AddressBookImpl::class)
->setConstructorArgs(
[
$this->addressBook,
@@ -267,7 +264,7 @@ class AddressBookImplTest extends TestCase {
public function testCreateUid() {
/** @var \PHPUnit_Framework_MockObject_MockObject | AddressBookImpl $addressBookImpl */
- $addressBookImpl = $this->getMockBuilder('OCA\DAV\CardDAV\AddressBookImpl')
+ $addressBookImpl = $this->getMockBuilder(AddressBookImpl::class)
->setConstructorArgs(
[
$this->addressBook,
@@ -299,7 +296,7 @@ class AddressBookImplTest extends TestCase {
public function testCreateEmptyVCard() {
$uid = 'uid';
$expectedVCard = new VCard();
- $expectedVCard->add(new Text($expectedVCard, 'UID', $uid));
+ $expectedVCard->UID = $uid;
$expectedVCardSerialized = $expectedVCard->serialize();
$result = $this->invokePrivate($this->addressBookImpl, 'createEmptyVCard', [$uid]);
@@ -335,10 +332,11 @@ class AddressBookImplTest extends TestCase {
$array = $this->invokePrivate($this->addressBookImpl, 'vCard2Array', ['uri', $vCard]);
unset($array['PRODID']);
+ unset($array['UID']);
$this->assertEquals([
'URI' => 'uri',
- 'VERSION' => '3.0',
+ 'VERSION' => '4.0',
'FN' => 'Full Name',
'CLOUD' => [
'cloud-user1@localhost',