@@ -70,19 +70,22 @@ public static function tagNodeProvider(): array {
7070 [
7171 true ,
7272 new SystemTag ('1 ' , 'Original ' , true , true ),
73- ['Renamed ' , true , true , null ]
73+ ['Renamed ' , true , true , null ],
74+ true ,
7475 ],
7576 [
7677 true ,
7778 new SystemTag ('1 ' , 'Original ' , true , true ),
78- ['Original ' , false , false , null ]
79+ ['Original ' , false , false , null ],
80+ true ,
7981 ],
8082 // non-admin
8183 [
82- // renaming allowed
84+ // renaming not allowed
8385 false ,
8486 new SystemTag ('1 ' , 'Original ' , true , true ),
85- ['Rename ' , true , true , '0082c9 ' ]
87+ ['Renamed ' , true , true , null ],
88+ false ,
8689 ],
8790 ];
8891 }
@@ -93,13 +96,18 @@ public function testUpdateTag(bool $isAdmin, ISystemTag $originalTag, array $cha
9396 ->method ('canUserSeeTag ' )
9497 ->with ($ originalTag )
9598 ->willReturn ($ originalTag ->isUserVisible () || $ isAdmin );
96- $ this ->tagManager ->expects ($ this ->once ())
97- ->method ('canUserAssignTag ' )
99+ $ this ->tagManager ->method ('canUserAssignTag ' )
98100 ->with ($ originalTag )
99101 ->willReturn ($ originalTag ->isUserAssignable () || $ isAdmin );
100- $ this ->tagManager ->expects ($ this ->once ())
101- ->method ('updateTag ' )
102- ->with (1 , $ changedArgs [0 ], $ changedArgs [1 ], $ changedArgs [2 ], $ changedArgs [3 ]);
102+ if ($ allowed ) {
103+ $ this ->tagManager ->expects ($ this ->once ())
104+ ->method ('updateTag ' )
105+ ->with (1 , $ changedArgs [0 ], $ changedArgs [1 ], $ changedArgs [2 ], $ changedArgs [3 ]);
106+ } else {
107+ $ this ->expectException (\Sabre \DAV \Exception \Forbidden::class);
108+ $ this ->tagManager ->expects ($ this ->never ())
109+ ->method ('updateTag ' );
110+ }
103111 $ this ->getTagNode ($ isAdmin , $ originalTag )
104112 ->update ($ changedArgs [0 ], $ changedArgs [1 ], $ changedArgs [2 ], $ changedArgs [3 ]);
105113 }
@@ -187,7 +195,7 @@ public function testUpdateTagAlreadyExists(): void {
187195 ->method ('updateTag ' )
188196 ->with (1 , 'Renamed ' , true , true )
189197 ->willThrowException (new TagAlreadyExistsException ());
190- $ this ->getTagNode (false , $ tag )->update ('Renamed ' , true , true , null );
198+ $ this ->getTagNode (true , $ tag )->update ('Renamed ' , true , true , null );
191199 }
192200
193201
@@ -207,7 +215,7 @@ public function testUpdateTagNotFound(): void {
207215 ->method ('updateTag ' )
208216 ->with (1 , 'Renamed ' , true , true )
209217 ->willThrowException (new TagNotFoundException ());
210- $ this ->getTagNode (false , $ tag )->update ('Renamed ' , true , true , null );
218+ $ this ->getTagNode (true , $ tag )->update ('Renamed ' , true , true , null );
211219 }
212220
213221 #[\PHPUnit \Framework \Attributes \DataProvider('adminFlagProvider ' )]
0 commit comments