aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJoas Schilling <213943+nickvergessen@users.noreply.github.com>2024-01-26 21:11:05 +0100
committerGitHub <noreply@github.com>2024-01-26 21:11:05 +0100
commitf7dea13c9245d59f8e890929078345d7161c12b4 (patch)
treedc3eb70f20282d0ccf8e68262c3ca03e5fb2621a /apps
parent01520d565ce9a65fe4c512518a75b116b805fe99 (diff)
parent58506952840049b69224ae119f89da0f25737a11 (diff)
downloadnextcloud-server-f7dea13c9245d59f8e890929078345d7161c12b4.tar.gz
nextcloud-server-f7dea13c9245d59f8e890929078345d7161c12b4.zip
Merge pull request #41003 from nextcloud/chore/migrate-behat-to-github
chore(tests): Run all unit tests on GitHub instead of Drone
Diffstat (limited to 'apps')
-rw-r--r--apps/dav/tests/unit/CalDAV/Reminder/NotifierTest.php14
-rw-r--r--apps/encryption/tests/Crypto/EncryptAllTest.php8
-rw-r--r--apps/user_ldap/lib/Configuration.php3
3 files changed, 20 insertions, 5 deletions
diff --git a/apps/dav/tests/unit/CalDAV/Reminder/NotifierTest.php b/apps/dav/tests/unit/CalDAV/Reminder/NotifierTest.php
index 08677d20267..10c421921b0 100644
--- a/apps/dav/tests/unit/CalDAV/Reminder/NotifierTest.php
+++ b/apps/dav/tests/unit/CalDAV/Reminder/NotifierTest.php
@@ -142,6 +142,14 @@ class NotifierTest extends TestCase {
$this->notifier->prepare($notification, 'en');
}
+ private static function hasPhpDatetimeDiffBug(): bool {
+ $d1 = \DateTime::createFromFormat(\DateTimeInterface::ATOM, '2023-11-22T11:52:00+01:00');
+ $d2 = new \DateTime('2023-11-22T10:52:03', new \DateTimeZone('UTC'));
+
+ // The difference is 3 seconds, not -1year+11months+…
+ return $d1->diff($d2)->y < 0;
+ }
+
public function dataPrepare(): array {
return [
[
@@ -150,7 +158,7 @@ class NotifierTest extends TestCase {
'title' => 'Title of this event',
'start_atom' => '2005-08-15T15:52:01+02:00'
],
- 'Title of this event (in 1 hour, 52 minutes)',
+ self::hasPhpDatetimeDiffBug() ? 'Title of this event' : 'Title of this event (in 1 hour, 52 minutes)',
[
'title' => 'Title of this event',
'description' => null,
@@ -172,7 +180,7 @@ class NotifierTest extends TestCase {
'title' => 'Title of this event',
'start_atom' => '2005-08-15T13:00:00+02:00',
],
- 'Title of this event (1 hour ago)',
+ self::hasPhpDatetimeDiffBug() ? 'Title of this event' : 'Title of this event (1 hour ago)',
[
'title' => 'Title of this event',
'description' => null,
@@ -281,7 +289,7 @@ class NotifierTest extends TestCase {
$notification->expects($this->once())
->method('setParsedSubject')
- ->with('Title of this event (6 hours ago)')
+ ->with(self::hasPhpDatetimeDiffBug() ? 'Title of this event' : 'Title of this event (6 hours ago)')
->willReturnSelf();
$this->expectException(AlreadyProcessedException::class);
diff --git a/apps/encryption/tests/Crypto/EncryptAllTest.php b/apps/encryption/tests/Crypto/EncryptAllTest.php
index 459f680a374..78b9b5f7e37 100644
--- a/apps/encryption/tests/Crypto/EncryptAllTest.php
+++ b/apps/encryption/tests/Crypto/EncryptAllTest.php
@@ -73,6 +73,9 @@ class EncryptAllTest extends TestCase {
/** @var \PHPUnit\Framework\MockObject\MockObject | \OCP\IL10N */
protected $l;
+ /** @var \PHPUnit\Framework\MockObject\MockObject | IFactory */
+ protected $l10nFactory;
+
/** @var \PHPUnit\Framework\MockObject\MockObject | \Symfony\Component\Console\Helper\QuestionHelper */
protected $questionHelper;
@@ -119,7 +122,10 @@ class EncryptAllTest extends TestCase {
$this->userInterface = $this->getMockBuilder(UserInterface::class)
->disableOriginalConstructor()->getMock();
- /* We need format method to return a string */
+ /**
+ * We need format method to return a string
+ * @var OutputFormatterInterface|\PHPUnit\Framework\MockObject\MockObject
+ */
$outputFormatter = $this->createMock(OutputFormatterInterface::class);
$outputFormatter->method('isDecorated')->willReturn(false);
$outputFormatter->method('format')->willReturnArgument(0);
diff --git a/apps/user_ldap/lib/Configuration.php b/apps/user_ldap/lib/Configuration.php
index 43d7b5cfbf1..b009ba3f480 100644
--- a/apps/user_ldap/lib/Configuration.php
+++ b/apps/user_ldap/lib/Configuration.php
@@ -607,6 +607,7 @@ class Configuration {
* Returns TRUE if the ldapHost variable starts with 'ldapi://'
*/
public function usesLdapi(): bool {
- return (substr($this->config['ldapHost'], 0, strlen('ldapi://')) === 'ldapi://');
+ $host = $this->config['ldapHost'];
+ return is_string($host) && (substr($host, 0, strlen('ldapi://')) === 'ldapi://');
}
}