@@ -61,18 +61,39 @@ public function setUpScenario() {
6161
6262 /** @AfterScenario */
6363 public function afterScenario () {
64- $ davUrl = $ this ->baseUrl . '/remote.php/dav/calendars/admin/MyCalendar ' ;
65- try {
66- $ this ->client ->delete (
67- $ davUrl ,
68- [
69- 'auth ' => [
70- 'admin ' ,
71- 'admin ' ,
72- ],
73- ]
74- );
75- } catch (\GuzzleHttp \Exception \ClientException $ e ) {
64+ foreach (['MyCalendar ' , 'MyCalendar2 ' ] as $ calendarName ) {
65+ try {
66+ $ this ->client ->delete (
67+ $ this ->baseUrl . '/remote.php/dav/calendars/admin/ ' . $ calendarName ,
68+ [
69+ 'auth ' => ['admin ' , 'admin ' ],
70+ 'headers ' => ['X-NC-CalDAV-No-Trashbin ' => '1 ' ],
71+ ]
72+ );
73+ } catch (\GuzzleHttp \Exception \ClientException $ e ) {
74+ }
75+ }
76+ }
77+
78+ /** @AfterScenario @caldav-delegation */
79+ public function afterDelegationScenario () {
80+ foreach (['calendar-proxy-read ' , 'calendar-proxy-write ' ] as $ proxyType ) {
81+ try {
82+ $ propPatch = new \Sabre \DAV \Xml \Request \PropPatch ();
83+ $ propPatch ->properties = ['{DAV:}group-member-set ' => new \Sabre \DAV \Xml \Property \Href ([])];
84+ $ xml = new \Sabre \Xml \Service ();
85+ $ body = $ xml ->write ('{DAV:}propertyupdate ' , $ propPatch , '/ ' );
86+ $ this ->client ->request (
87+ 'PROPPATCH ' ,
88+ $ this ->baseUrl . '/remote.php/dav/principals/users/admin/ ' . $ proxyType ,
89+ [
90+ 'headers ' => ['Content-Type ' => 'application/xml; charset=UTF-8 ' ],
91+ 'body ' => $ body ,
92+ 'auth ' => ['admin ' , 'admin ' ],
93+ ]
94+ );
95+ } catch (\GuzzleHttp \Exception \ClientException $ e ) {
96+ }
7697 }
7798 }
7899
0 commit comments