1<?php 2 3namespace Sabre\CalDAV; 4 5use Sabre\DAVACL; 6 7class ShareableCalendarTest extends \PHPUnit_Framework_TestCase { 8 9 protected $backend; 10 protected $instance; 11 12 function setUp() { 13 14 $props = array( 15 'id' => 1, 16 ); 17 18 $this->backend = new Backend\MockSharing( 19 array($props) 20 ); 21 $this->backend->updateShares(1, array( 22 array( 23 'href' => 'mailto:removeme@example.org', 24 'commonName' => 'To be removed', 25 'readOnly' => true, 26 ), 27 ), array()); 28 29 $this->instance = new ShareableCalendar($this->backend, $props); 30 31 } 32 33 function testUpdateShares() { 34 35 $this->instance->updateShares(array( 36 array( 37 'href' => 'mailto:test@example.org', 38 'commonName' => 'Foo Bar', 39 'summary' => 'Booh', 40 'readOnly' => false, 41 ), 42 ), array('mailto:removeme@example.org')); 43 44 $this->assertEquals(array(array( 45 'href' => 'mailto:test@example.org', 46 'commonName' => 'Foo Bar', 47 'summary' => 'Booh', 48 'readOnly' => false, 49 'status' => SharingPlugin::STATUS_NORESPONSE, 50 )), $this->instance->getShares()); 51 52 } 53 54 function testPublish() { 55 56 $this->assertNull($this->instance->setPublishStatus(true)); 57 $this->assertNull($this->instance->setPublishStatus(false)); 58 59 } 60} 61