@@ -184,7 +184,7 @@ public function testRemoveMounts(): void {
184184 ->expects ($ this ->exactly (2 ))
185185 ->method ('dispatchTyped ' )
186186 ->with ($ this ->callback (function (UserMountAddedEvent |UserMountRemovedEvent $ event ) use (&$ operation ) {
187- return match (++$ operation ) {
187+ return match (++$ operation ) {
188188 1 => $ event instanceof UserMountAddedEvent && $ event ->mountPoint ->getMountPoint () === '/asd/ ' ,
189189 2 => $ event instanceof UserMountRemovedEvent && $ event ->mountPoint ->getMountPoint () === '/asd/ ' ,
190190 default => false ,
@@ -215,7 +215,7 @@ public function testChangeMounts(): void {
215215 ->expects ($ this ->exactly (3 ))
216216 ->method ('dispatchTyped ' )
217217 ->with ($ this ->callback (function (UserMountAddedEvent |UserMountRemovedEvent $ event ) use (&$ operation ) {
218- return match (++$ operation ) {
218+ return match (++$ operation ) {
219219 1 => $ event instanceof UserMountAddedEvent && $ event ->mountPoint ->getMountPoint () === '/bar/ ' ,
220220 2 => $ event instanceof UserMountAddedEvent && $ event ->mountPoint ->getMountPoint () === '/foo/ ' ,
221221 3 => $ event instanceof UserMountRemovedEvent && $ event ->mountPoint ->getMountPoint () === '/bar/ ' ,
@@ -251,7 +251,7 @@ public function testChangeMountId(): void {
251251 ->expects ($ this ->exactly (2 ))
252252 ->method ('dispatchTyped ' )
253253 ->with ($ this ->callback (function (UserMountAddedEvent |UserMountUpdatedEvent $ event ) use (&$ operation ) {
254- return match (++$ operation ) {
254+ return match (++$ operation ) {
255255 1 => $ event instanceof UserMountAddedEvent && $ event ->mountPoint ->getMountPoint () === '/foo/ ' ,
256256 2 => $ event instanceof UserMountUpdatedEvent && $ event ->oldMountPoint ->getMountId () === null && $ event ->newMountPoint ->getMountId () === 1 ,
257257 default => false ,
@@ -596,4 +596,26 @@ public function testMigrateMountProvider(): void {
596596 $ this ->assertCount (1 , $ cachedMounts );
597597 $ this ->assertEquals ('dummy ' , $ cachedMounts [$ this ->keyForMount ($ mount1 )]->getMountProvider ());
598598 }
599+
600+ public function testChangedSameRootId (): void {
601+ $ user = $ this ->userManager ->get ('u1 ' );
602+
603+ [$ storage ] = $ this ->getStorage (10 );
604+ $ mount1 = new MountPoint ($ storage , '/asd/ ' );
605+ $ mount2 = new MountPoint ($ storage , '/asd2/ ' );
606+
607+ $ this ->cache ->registerMounts ($ user , [$ mount1 , $ mount2 ]);
608+
609+ $ mount2 = new MountPoint ($ storage , '/asd2/ ' , null , null , null , 1 );
610+ $ this ->cache ->registerMounts ($ user , [$ mount1 , $ mount2 ]);
611+
612+ $ cached = $ this ->cache ->getMountsForUser ($ user );
613+ usort ($ cached , fn (ICachedMountInfo $ a , ICachedMountInfo $ b ) => $ a ->getMountPoint () <=> $ b ->getMountPoint ());
614+
615+ $ mountPoints = array_map (fn (ICachedMountInfo $ mountInfo ) => $ mountInfo ->getMountPoint (), $ cached );
616+ $ this ->assertEquals (['/asd/ ' , '/asd2/ ' ], $ mountPoints );
617+
618+ $ mountIds = array_map (fn (ICachedMountInfo $ mountInfo ) => $ mountInfo ->getMountId (), $ cached );
619+ $ this ->assertEquals ([null , 1 ], $ mountIds );
620+ }
599621}
0 commit comments