]> git.mxchange.org Git - friendica.git/blobdiff - tests/src/Util/TemporalTest.php
spelling: cached
[friendica.git] / tests / src / Util / TemporalTest.php
index fe0429af810d500097dd86d445447c1d4fa1d0e3..10e3646ae472a45251168dc633246806eca0f557 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2022, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -60,5 +60,23 @@ class TemporalTest extends TestCase
                        Temporal::getRelativeDate($minuteAgo, true, $clock),
                        sprintf($format, 1, DI::l10n()->t('minute'))
                );
+
+               $almostAnHourAgoInterval = new \DateInterval('PT59M59S');
+               $almostAnHourAgoInterval->invert = 1;
+               $almostAnHourAgo = (clone $clock->now())->add($almostAnHourAgoInterval);
+
+               self::assertEquals(
+                       Temporal::getRelativeDate($almostAnHourAgo->format(DateTimeFormat::MYSQL), true, $clock),
+                       sprintf($format, 59, DI::l10n()->t('minutes'))
+               );
+
+               $anHourAgoInterval = new \DateInterval('PT1H');
+               $anHourAgoInterval->invert = 1;
+               $anHourAgo = (clone $clock->now())->add($anHourAgoInterval);
+
+               self::assertEquals(
+                       Temporal::getRelativeDate($anHourAgo->format(DateTimeFormat::MYSQL), true, $clock),
+                       sprintf($format, 1, DI::l10n()->t('hour'))
+               );
        }
 }