@@ -23,15 +23,15 @@ final class ReminderServiceTest extends \OCA\Libresign\Tests\Unit\TestCase {
2323 protected IJobList |MockObject $ jobList ;
2424 protected IAppConfig $ appConfig ;
2525 protected IDateTimeZone $ dateTimeZone ;
26- protected ITimeFactory $ time ;
26+ protected ITimeFactory | MockObject $ time ;
2727 protected SignRequestMapper |MockObject $ signRequestMapper ;
2828 protected IdentifyMethodService |MockObject $ identifyMethodService ;
2929
3030 public function setUp (): void {
3131 $ this ->jobList = $ this ->createMock (IJobList::class);
3232 $ this ->appConfig = $ this ->getMockAppConfig ();
3333 $ this ->dateTimeZone = Server::get (IDateTimeZone::class);
34- $ this ->time = Server:: get (ITimeFactory::class);
34+ $ this ->time = $ this -> createMock (ITimeFactory::class);
3535 $ this ->signRequestMapper = $ this ->createMock (SignRequestMapper::class);
3636 $ this ->identifyMethodService = $ this ->createMock (IdentifyMethodService::class);
3737 }
@@ -105,7 +105,7 @@ public function testWillNotify(array $summarized, \DateTime $now, int $daysBefor
105105 }
106106
107107 public static function providerWillNotify (): array {
108- $ now = ( new DateTime ())-> setTime ( 12 , 0 );
108+ $ now = new DateTime (' 2025-10-09 12:00:00 ' , new \ DateTimeZone ( ' UTC ' ) );
109109
110110 return [
111111 'no notifications, should not send with all zero and null ' => [
@@ -327,6 +327,11 @@ public function testSave(
327327 string $ sendTimer ,
328328 array $ expected ,
329329 ): void {
330+ // Setup fixed time for consistent testing
331+ $ fixedTime = new DateTime ('2025-10-09 09:00:00 ' , new \DateTimeZone ('UTC ' ));
332+ $ this ->time ->method ('getDateTime ' )
333+ ->willReturn ($ fixedTime );
334+
330335 $ service = $ this ->getService ();
331336 $ actual = $ service ->save ($ daysBefore , $ daysBetween , $ max , $ sendTimer );
332337 $ this ->assertEquals ($ expected , $ actual );
@@ -347,7 +352,7 @@ public function testSave(
347352 }
348353
349354 public static function providerSave (): array {
350- $ now = (new DateTime ());
355+ $ now = (new DateTime (' 2025-10-09 09:00:00 ' , new \ DateTimeZone ( ' UTC ' ) ));
351356 return [
352357 [
353358 'daysBefore ' => 0 , 'daysBetween ' => 0 , 'max ' => 0 , 'sendTimer ' => '' ,
0 commit comments