@@ -606,4 +606,44 @@ public function testGetVersionWithFileInfo() {
606606 $ this ->assertSame (1337 , $ this ->instance ->getVersion ('/admin/files/myfile.txt ' , $ view ));
607607 }
608608
609+ public function testSetVersionWithFileInfo () {
610+ $ view = $ this ->getMockBuilder ('\\OC \\Files \\View ' )
611+ ->disableOriginalConstructor ()->getMock ();
612+ $ cache = $ this ->getMockBuilder ('\\OCP \\Files \\Cache \\ICache ' )
613+ ->disableOriginalConstructor ()->getMock ();
614+ $ cache ->expects ($ this ->once ())
615+ ->method ('update ' )
616+ ->with (123 , ['encrypted ' => 5 , 'encryptedVersion ' => 5 ]);
617+ $ storage = $ this ->getMockBuilder ('\\OCP \\Files \\Storage ' )
618+ ->disableOriginalConstructor ()->getMock ();
619+ $ storage ->expects ($ this ->once ())
620+ ->method ('getCache ' )
621+ ->willReturn ($ cache );
622+ $ fileInfo = $ this ->getMockBuilder ('\\OC \\Files \\FileInfo ' )
623+ ->disableOriginalConstructor ()->getMock ();
624+ $ fileInfo ->expects ($ this ->once ())
625+ ->method ('getStorage ' )
626+ ->willReturn ($ storage );
627+ $ fileInfo ->expects ($ this ->once ())
628+ ->method ('getId ' )
629+ ->willReturn (123 );
630+ $ view ->expects ($ this ->once ())
631+ ->method ('getFileInfo ' )
632+ ->with ('/admin/files/myfile.txt ' )
633+ ->willReturn ($ fileInfo );
634+
635+ $ this ->instance ->setVersion ('/admin/files/myfile.txt ' , 5 , $ view );
636+ }
637+
638+ public function testSetVersionWithoutFileInfo () {
639+ $ view = $ this ->getMockBuilder ('\\OC \\Files \\View ' )
640+ ->disableOriginalConstructor ()->getMock ();
641+ $ view ->expects ($ this ->once ())
642+ ->method ('getFileInfo ' )
643+ ->with ('/admin/files/myfile.txt ' )
644+ ->willReturn (false );
645+
646+ $ this ->instance ->setVersion ('/admin/files/myfile.txt ' , 5 , $ view );
647+ }
648+
609649}
0 commit comments