public function testMigration()
 {
     /** @var CalendarAdapter | \PHPUnit_Framework_MockObject_MockObject $adapter */
     $adapter = $this->mockAdapter();
     /** @var CalDavBackend | \PHPUnit_Framework_MockObject_MockObject $cardDav */
     $cardDav = $this->getMockBuilder('\\OCA\\Dav\\CalDAV\\CalDAVBackend')->disableOriginalConstructor()->getMock();
     $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');
     $m = new \OCA\Dav\Migration\MigrateCalendars($adapter, $cardDav);
     $m->migrateForUser('test01');
 }
Beispiel #2
0
 public function testMigration()
 {
     /** @var CalendarAdapter | \PHPUnit_Framework_MockObject_MockObject $adapter */
     $adapter = $this->mockAdapter([['share_type' => '1', 'share_with' => 'users', 'permissions' => '31'], ['share_type' => '2', 'share_with' => 'adam', 'permissions' => '1']]);
     /** @var CalDavBackend | \PHPUnit_Framework_MockObject_MockObject $cardDav */
     $cardDav = $this->getMockBuilder('\\OCA\\Dav\\CalDAV\\CalDAVBackend')->disableOriginalConstructor()->getMock();
     $cardDav->expects($this->any())->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');
     $cardDav->expects($this->once())->method('updateShares')->with($this->anything(), [['href' => 'principal:principals/groups/users', 'readOnly' => false], ['href' => 'principal:principals/users/adam', 'readOnly' => true]]);
     /** @var ILogger $logger */
     $logger = $this->getMockBuilder('\\OCP\\ILogger')->disableOriginalConstructor()->getMock();
     $m = new \OCA\Dav\Migration\MigrateCalendars($adapter, $cardDav, $logger, null);
     $m->migrateForUser('test01');
 }