summaryrefslogtreecommitdiffstats
path: root/apps/dav/tests/unit
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2016-03-07 14:11:14 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2016-03-07 15:04:19 +0100
commitd32b35fc7f89dd941267d5d7b907b05070f5f81c (patch)
treeb57c748cb0d1609737e6481aa8cd37f2d891cd1e /apps/dav/tests/unit
parenta61fa5b52675d0f1742c0dbe605df7a816ce1570 (diff)
downloadnextcloud-server-d32b35fc7f89dd941267d5d7b907b05070f5f81c.tar.gz
nextcloud-server-d32b35fc7f89dd941267d5d7b907b05070f5f81c.zip
Handle calendar migration issue by writing the faulty event to the log and continue
Diffstat (limited to 'apps/dav/tests/unit')
-rw-r--r--apps/dav/tests/unit/migration/migratecalendartest.php12
1 files changed, 7 insertions, 5 deletions
diff --git a/apps/dav/tests/unit/migration/migratecalendartest.php b/apps/dav/tests/unit/migration/migratecalendartest.php
index 1058773ffff..ad3f6af2322 100644
--- a/apps/dav/tests/unit/migration/migratecalendartest.php
+++ b/apps/dav/tests/unit/migration/migratecalendartest.php
@@ -22,6 +22,7 @@ namespace OCA\DAV\Tests\Unit\Migration;
use OCA\DAV\CalDAV\CalDavBackend;
use OCA\Dav\Migration\CalendarAdapter;
+use OCP\ILogger;
use Test\TestCase;
class MigrateCalendarTest extends TestCase {
@@ -35,15 +36,17 @@ class MigrateCalendarTest extends TestCase {
$cardDav->method('createCalendar')->willReturn(666);
$cardDav->expects($this->once())->method('createCalendar')->with('principals/users/test01', 'test_contacts');
$cardDav->expects($this->once())->method('createCalendarObject')->with(666, '63f0dd6c-39d5-44be-9d34-34e7a7441fc2.ics', 'BEGIN:VCARD');
+ /** @var ILogger $logger */
+ $logger = $this->getMockBuilder('\OCP\ILogger')->disableOriginalConstructor()->getMock();
- $m = new \OCA\Dav\Migration\MigrateCalendars($adapter, $cardDav);
+ $m = new \OCA\Dav\Migration\MigrateCalendars($adapter, $cardDav, $logger, null);
$m->migrateForUser('test01');
}
/**
* @return \PHPUnit_Framework_MockObject_MockObject
*/
- private function mockAdapter($shares = []) {
+ private function mockAdapter($shares = [], $calData = 'BEGIN:VCARD') {
$adapter = $this->getMockBuilder('\OCA\Dav\Migration\CalendarAdapter')
->disableOriginalConstructor()
->getMock();
@@ -62,15 +65,14 @@ class MigrateCalendarTest extends TestCase {
'components' => 'VEVENT,VTODO,VJOURNAL'
]);
});
- $adapter->method('foreachCalendarObject')->willReturnCallback(function ($addressBookId, \Closure $callBack) {
+ $adapter->method('foreachCalendarObject')->willReturnCallback(function ($addressBookId, \Closure $callBack) use ($calData) {
$callBack([
'userid' => $addressBookId,
'uri' => '63f0dd6c-39d5-44be-9d34-34e7a7441fc2.ics',
- 'calendardata' => 'BEGIN:VCARD'
+ 'calendardata' => $calData
]);
});
$adapter->method('getShares')->willReturn($shares);
return $adapter;
}
-
}