2626namespace OCA \DAV \Tests \Unit \DAV \Settings ;
2727
2828use OCA \DAV \Settings \CalDAVSettings ;
29+ use OCP \AppFramework \Http \TemplateResponse ;
2930use OCP \IConfig ;
3031use OCP \AppFramework \Services \IInitialState ;
32+ use OCP \IURLGenerator ;
33+ use PHPUnit \Framework \MockObject \MockObject ;
3134use Test \TestCase ;
3235
3336class CalDAVSettingsTest extends TestCase {
3437
35- /** @var IConfig|\PHPUnit\Framework\MockObject\ MockObject */
38+ /** @var IConfig|MockObject */
3639 private $ config ;
3740
38- /** @var OCP\AppFramework\Services\ IInitialState|\PHPUnit\Framework\MockObject\ MockObject */
41+ /** @var IInitialState|MockObject */
3942 private $ initialState ;
4043
44+ /** @var IURLGenerator|MockObject */
45+ private $ urlGenerator ;
46+
4147 /** @var CalDAVSettings */
42- private $ settings ;
48+ private CalDAVSettings $ settings ;
4349
4450 protected function setUp (): void {
4551 parent ::setUp ();
4652
4753 $ this ->config = $ this ->createMock (IConfig::class);
4854 $ this ->initialState = $ this ->createMock (IInitialState::class);
49- $ this ->settings = new CalDAVSettings ($ this ->config , $ this ->initialState );
55+ $ this ->urlGenerator = $ this ->createMock (IURLGenerator::class);
56+ $ this ->settings = new CalDAVSettings ($ this ->config , $ this ->initialState , $ this ->urlGenerator );
5057 }
5158
5259 public function testGetForm () {
@@ -58,16 +65,22 @@ public function testGetForm() {
5865 ['dav ' , 'sendEventRemindersPush ' , 'no ' ],
5966 )
6067 ->will ($ this ->onConsecutiveCalls ('yes ' , 'no ' , 'yes ' , 'yes ' ));
68+ $ this ->urlGenerator
69+ ->expects ($ this ->once ())
70+ ->method ('linkToDocs ' )
71+ ->with ('user-sync-calendars ' )
72+ ->willReturn ('Some docs URL ' );
6173 $ this ->initialState ->method ('provideInitialState ' )
6274 ->withConsecutive (
75+ ['userSyncCalendarsDocUrl ' , 'Some docs URL ' ],
6376 ['sendInvitations ' , true ],
6477 ['generateBirthdayCalendar ' , false ],
6578 ['sendEventReminders ' , true ],
6679 ['sendEventRemindersPush ' , true ],
6780 );
6881 $ result = $ this ->settings ->getForm ();
6982
70- $ this ->assertInstanceOf (' OCP\AppFramework\Http\ TemplateResponse' , $ result );
83+ $ this ->assertInstanceOf (TemplateResponse::class , $ result );
7184 }
7285
7386 public function testGetSection () {
0 commit comments