diff --git a/.github/workflows/phpunit-mariadb.yml b/.github/workflows/phpunit-mariadb.yml
index 9a9b646792f..b8b70029dc3 100644
--- a/.github/workflows/phpunit-mariadb.yml
+++ b/.github/workflows/phpunit-mariadb.yml
@@ -104,6 +104,7 @@ jobs:
ini-file: development
ini-values: disable_functions=""
env:
+ fail-fast: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up dependencies
diff --git a/.github/workflows/phpunit-memcached.yml b/.github/workflows/phpunit-memcached.yml
index 96729c1e8dd..7aa42765fe9 100644
--- a/.github/workflows/phpunit-memcached.yml
+++ b/.github/workflows/phpunit-memcached.yml
@@ -88,6 +88,7 @@ jobs:
ini-file: development
ini-values: disable_functions=""
env:
+ fail-fast: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up dependencies
diff --git a/.github/workflows/phpunit-mysql-sharding.yml b/.github/workflows/phpunit-mysql-sharding.yml
index f8c458b8e96..204b151b92e 100644
--- a/.github/workflows/phpunit-mysql-sharding.yml
+++ b/.github/workflows/phpunit-mysql-sharding.yml
@@ -56,8 +56,8 @@ jobs:
strategy:
fail-fast: false
matrix:
- php-versions: ['8.2']
- mysql-versions: ['8.4']
+ php-versions: ["8.2"]
+ mysql-versions: ["8.4"]
name: Sharding - MySQL ${{ matrix.mysql-versions }} (PHP ${{ matrix.php-versions }}) - database tests
@@ -137,6 +137,7 @@ jobs:
ini-file: development
ini-values: disable_functions=""
env:
+ fail-fast: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up dependencies
diff --git a/.github/workflows/phpunit-mysql.yml b/.github/workflows/phpunit-mysql.yml
index ffc1f9d90a3..a0f4a3f3136 100644
--- a/.github/workflows/phpunit-mysql.yml
+++ b/.github/workflows/phpunit-mysql.yml
@@ -104,6 +104,7 @@ jobs:
ini-file: development
ini-values: disable_functions=""
env:
+ fail-fast: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up dependencies
diff --git a/.github/workflows/phpunit-nodb.yml b/.github/workflows/phpunit-nodb.yml
index 3c7af086a4b..3504d356875 100644
--- a/.github/workflows/phpunit-nodb.yml
+++ b/.github/workflows/phpunit-nodb.yml
@@ -59,9 +59,9 @@ jobs:
strategy:
fail-fast: false
matrix:
- php-versions: ['8.3', '8.4', '8.5']
+ php-versions: ["8.3", "8.4", "8.5"]
include:
- - php-versions: '8.2'
+ - php-versions: "8.2"
coverage: ${{ github.event_name != 'pull_request' }}
name: No DB unit tests (PHP ${{ matrix.php-versions }})
@@ -86,12 +86,13 @@ jobs:
with:
php-version: ${{ matrix.php-versions }}
# https://docs.nextcloud.com/server/stable/admin_manual/installation/source_installation.html#prerequisites-for-manual-installation
- extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, imagick, intl, json, libxml, mbstring, openssl, pcntl, posix, redis, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite
+ extensions: apcu, bz2, ctype, curl, dom, fileinfo, gd, iconv, imagick, intl, json, libxml, mbstring, openssl, pcntl, pdo_sqlite, posix, redis, session, simplexml, sqlite, xmlreader, xmlwriter, zip, zlib
coverage: ${{ matrix.coverage && 'xdebug' || 'none' }}
ini-file: development
# Required for tests that use pcntl
ini-values: disable_functions=""
env:
+ fail-fast: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up dependencies
@@ -106,7 +107,7 @@ jobs:
php -f tests/enable_all.php
- name: PHPUnit nodb testsuite
- run: composer run test -- --exclude-group DB --exclude-group SLOWDB --log-junit junit.xml ${{ matrix.coverage && '--coverage-clover ./clover.nodb.xml' || '' }}
+ run: composer run test -- --exclude-group DB --exclude-group SLOWDB --exclude-group Memcached --exclude-group PRIMARY-swift --exclude-group PRIMARY-s3 --exclude-group PRIMARY-azure --log-junit junit.xml ${{ matrix.coverage && '--coverage-clover ./clover.nodb.xml' || '' }}
- name: Upload nodb code coverage
if: ${{ !cancelled() && matrix.coverage }}
diff --git a/.github/workflows/phpunit-object-store-primary.yml b/.github/workflows/phpunit-object-store-primary.yml
index b7187d349a0..0b1e0106b71 100644
--- a/.github/workflows/phpunit-object-store-primary.yml
+++ b/.github/workflows/phpunit-object-store-primary.yml
@@ -49,8 +49,8 @@ jobs:
strategy:
fail-fast: false
matrix:
- php-versions: ['8.2']
- key: ['s3', 's3-multibucket']
+ php-versions: ["8.2"]
+ key: ["s3", "s3-multibucket"]
name: php${{ matrix.php-versions }}-${{ matrix.key }}-minio
@@ -84,6 +84,7 @@ jobs:
php-version: ${{ matrix.php-versions }}
extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, redis, session, simplexml, xmlreader, xmlwriter, zip, zlib, sqlite, pdo_sqlite
env:
+ fail-fast: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Nextcloud
@@ -113,10 +114,9 @@ jobs:
docker ps -a
docker ps -aq | while read container ; do IMAGE=$(docker inspect --format='{{.Config.Image}}' $container); echo $IMAGE; docker logs $container; echo "\n\n" ; done
-
object-store-primary-summary:
runs-on: ubuntu-latest-low
- needs: [changes,object-store-primary-tests-minio]
+ needs: [changes, object-store-primary-tests-minio]
if: always()
diff --git a/.github/workflows/phpunit-oci.yml b/.github/workflows/phpunit-oci.yml
index c53687707d9..2e524df428f 100644
--- a/.github/workflows/phpunit-oci.yml
+++ b/.github/workflows/phpunit-oci.yml
@@ -111,6 +111,7 @@ jobs:
ini-file: development
ini-values: disable_functions=""
env:
+ fail-fast: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up dependencies
diff --git a/.github/workflows/phpunit-pgsql.yml b/.github/workflows/phpunit-pgsql.yml
index a7c38143156..789ac9ff0d5 100644
--- a/.github/workflows/phpunit-pgsql.yml
+++ b/.github/workflows/phpunit-pgsql.yml
@@ -107,6 +107,7 @@ jobs:
ini-file: development
ini-values: disable_functions=""
env:
+ fail-fast: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up dependencies
diff --git a/.github/workflows/phpunit-sqlite.yml b/.github/workflows/phpunit-sqlite.yml
index 22236155fec..0ff8a56e5a1 100644
--- a/.github/workflows/phpunit-sqlite.yml
+++ b/.github/workflows/phpunit-sqlite.yml
@@ -90,6 +90,7 @@ jobs:
ini-file: development
ini-values: disable_functions=""
env:
+ fail-fast: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set up dependencies
@@ -110,7 +111,7 @@ jobs:
run: ./occ app:list && echo "======= System config =======" && ./occ config:list system
- name: PHPUnit database tests
- run: composer run test:db -- --log-junit junit.xml ${{ matrix.coverage && '--coverage-clover ./clover.db.xml' || '' }} tests/lib/Preview/PostscriptTest.php
+ run: composer run test:db -- --log-junit junit.xml ${{ matrix.coverage && '--coverage-clover ./clover.db.xml' || '' }}
- name: Upload db code coverage
if: ${{ !cancelled() && matrix.coverage }}
diff --git a/apps/dav/lib/CardDAV/AddressBookImpl.php b/apps/dav/lib/CardDAV/AddressBookImpl.php
index 0668d8fdb73..2413b2c9cc3 100644
--- a/apps/dav/lib/CardDAV/AddressBookImpl.php
+++ b/apps/dav/lib/CardDAV/AddressBookImpl.php
@@ -41,9 +41,10 @@ class AddressBookImpl implements IAddressBookEnabled, ICreateContactFromString {
/**
* @return string defining the technical unique key
* @since 5.0.0
+ * @since 35.0.0 Typed return type
*/
#[\Override]
- public function getKey() {
+ public function getKey(): string {
return (string)$this->addressBookInfo['id'];
}
diff --git a/apps/dav/lib/Connector/Sabre/Principal.php b/apps/dav/lib/Connector/Sabre/Principal.php
index 6d406b1739a..a29961c2a2a 100644
--- a/apps/dav/lib/Connector/Sabre/Principal.php
+++ b/apps/dav/lib/Connector/Sabre/Principal.php
@@ -496,10 +496,9 @@ class Principal implements BackendInterface {
};
$userId = $user->getUID();
- $displayName = $user->getDisplayName();
$principal = [
'uri' => $this->principalPrefix . '/' . $userId,
- '{DAV:}displayname' => is_null($displayName) ? $userId : $displayName,
+ '{DAV:}displayname' => $user->getDisplayName(),
'{urn:ietf:params:xml:ns:caldav}calendar-user-type' => 'INDIVIDUAL',
];
diff --git a/apps/dav/tests/unit/Connector/Sabre/AddExtraHeadersPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/AddExtraHeadersPluginTest.php
index 2906afea7d8..f913010773b 100644
--- a/apps/dav/tests/unit/Connector/Sabre/AddExtraHeadersPluginTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/AddExtraHeadersPluginTest.php
@@ -81,9 +81,13 @@ class AddExtraHeadersPluginTest extends TestCase {
$this->tree->expects($this->once())->method('getNodeForPath')
->willReturn($node);
- $user = $this->createMock(IUser::class);
- $node->expects($this->once())->method('getOwner')->willReturn($user);
- $user->expects($this->once())->method('getUID')->willReturn($ownerId);
+ if ($ownerId !== null) {
+ $user = $this->createMock(IUser::class);
+ $node->expects($this->once())->method('getOwner')->willReturn($user);
+ $user->expects($this->once())->method('getUID')->willReturn($ownerId);
+ } else {
+ $node->expects($this->once())->method('getOwner')->willReturn(null);
+ }
$node->expects($this->once())->method('getDavPermissions')->willReturn($permissions);
$matcher = $this->exactly($expectedInvocations);
diff --git a/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php b/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php
index 8699903e1ec..8cd19b1143c 100644
--- a/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php
+++ b/apps/dav/tests/unit/Connector/Sabre/PrincipalTest.php
@@ -101,6 +101,10 @@ class PrincipalTest extends TestCase {
->expects($this->once())
->method('getSystemEMailAddress')
->willReturn('bar@nextcloud.com');
+ $barUser
+ ->expects($this->once())
+ ->method('getDisplayName')
+ ->willReturn('bar');
$this->userManager
->expects($this->once())
->method('search')
@@ -189,6 +193,10 @@ class PrincipalTest extends TestCase {
->expects($this->once())
->method('getUID')
->willReturn('foo');
+ $fooUser
+ ->expects($this->once())
+ ->method('getDisplayName')
+ ->willReturn('foo');
$this->userManager
->expects($this->once())
->method('get')
@@ -221,6 +229,10 @@ class PrincipalTest extends TestCase {
->expects($this->once())
->method('getUID')
->willReturn('foo');
+ $fooUser
+ ->expects($this->once())
+ ->method('getDisplayName')
+ ->willReturn('foo');
$this->userManager
->expects($this->once())
->method('get')
diff --git a/apps/files_sharing/tests/ShareTest.php b/apps/files_sharing/tests/ShareTest.php
index 1ed6bc9b3fe..eedd3aba726 100644
--- a/apps/files_sharing/tests/ShareTest.php
+++ b/apps/files_sharing/tests/ShareTest.php
@@ -148,8 +148,6 @@ class ShareTest extends TestCase {
}
public function testShareWithGroupUniqueName(): void {
- $this->markTestSkipped('TODO: Disable because fails on drone');
-
$this->loginHelper(self::TEST_FILES_SHARING_API_USER1);
Filesystem::file_put_contents('test.txt', 'test');
diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php
index b5edf37bf2f..b32b2ccb7c6 100644
--- a/apps/files_trashbin/lib/Trashbin.php
+++ b/apps/files_trashbin/lib/Trashbin.php
@@ -850,7 +850,7 @@ class Trashbin implements IEventListener {
$softQuota = true;
$quota = $user->getQuota();
- if ($quota === null || $quota === 'none') {
+ if ($quota === 'none') {
$quota = Filesystem::free_space('/');
$softQuota = false;
// inf or unknown free space
diff --git a/apps/files_versions/lib/Storage.php b/apps/files_versions/lib/Storage.php
index 47f14d96b61..cf49e5a1d4d 100644
--- a/apps/files_versions/lib/Storage.php
+++ b/apps/files_versions/lib/Storage.php
@@ -879,7 +879,7 @@ class Storage {
$softQuota = true;
$quota = $user->getQuota();
- if ($quota === null || $quota === 'none') {
+ if ($quota === 'none') {
$quota = Filesystem::free_space('/');
$softQuota = false;
} else {
diff --git a/apps/provisioning_api/lib/Controller/GroupsController.php b/apps/provisioning_api/lib/Controller/GroupsController.php
index b251610e67f..3cda3ae74ba 100644
--- a/apps/provisioning_api/lib/Controller/GroupsController.php
+++ b/apps/provisioning_api/lib/Controller/GroupsController.php
@@ -216,7 +216,7 @@ class GroupsController extends AUserDataOCSController {
foreach ($users as $user) {
try {
/** @var IUser $user */
- $userId = (string)$user->getUID();
+ $userId = $user->getUID();
$userData = $this->getUserData($userId);
// Do not insert empty entry
if ($userData !== null) {
diff --git a/apps/settings/tests/Controller/UsersControllerTest.php b/apps/settings/tests/Controller/UsersControllerTest.php
index 39a4dbc42c0..1a47fa5b74f 100644
--- a/apps/settings/tests/Controller/UsersControllerTest.php
+++ b/apps/settings/tests/Controller/UsersControllerTest.php
@@ -675,7 +675,7 @@ class UsersControllerTest extends \Test\TestCase {
}
#[\PHPUnit\Framework\Attributes\DataProvider(methodName: 'dataTestSaveUserSettings')]
- public function testSaveUserSettings(array $data, ?string $oldEmailAddress, ?string $oldDisplayName): void {
+ public function testSaveUserSettings(array $data, ?string $oldEmailAddress, string $oldDisplayName): void {
$controller = $this->getController();
$user = $this->createMock(IUser::class);
@@ -690,7 +690,7 @@ class UsersControllerTest extends \Test\TestCase {
->with($data[IAccountManager::PROPERTY_EMAIL]['value']);
}
- if ($data[IAccountManager::PROPERTY_DISPLAYNAME]['value'] === $oldDisplayName ?? '') {
+ if ($data[IAccountManager::PROPERTY_DISPLAYNAME]['value'] === $oldDisplayName) {
$user->expects($this->never())->method('setDisplayName');
} else {
$user->expects($this->once())->method('setDisplayName')
@@ -775,7 +775,7 @@ class UsersControllerTest extends \Test\TestCase {
IAccountManager::PROPERTY_DISPLAYNAME => ['value' => 'john doe'],
],
'john@example.com',
- null
+ ''
],
[
[
@@ -783,7 +783,7 @@ class UsersControllerTest extends \Test\TestCase {
IAccountManager::PROPERTY_DISPLAYNAME => ['value' => 'john doe'],
],
'JOHN@example.com',
- null
+ ''
],
];
}
diff --git a/apps/user_ldap/lib/Connection.php b/apps/user_ldap/lib/Connection.php
index 3bc0580be36..3cc86922dad 100644
--- a/apps/user_ldap/lib/Connection.php
+++ b/apps/user_ldap/lib/Connection.php
@@ -313,7 +313,7 @@ class Connection extends LDAPUtility {
$key = $this->getCacheKey($key);
$value = base64_encode(json_encode($value));
$ttl = $ttlOverride ?? $this->configuration->ldapCacheTTL;
- $this->cache->set($key, $value, $ttl);
+ $this->cache->set($key, $value, (int)$ttl);
}
public function clearCache() {
diff --git a/apps/user_ldap/tests/AccessTest.php b/apps/user_ldap/tests/AccessTest.php
index 8450e787a87..3551daf261b 100644
--- a/apps/user_ldap/tests/AccessTest.php
+++ b/apps/user_ldap/tests/AccessTest.php
@@ -712,7 +712,7 @@ class AccessTest extends TestCase {
->method('__get')
->willReturnMap([
[ 'ldapUserDisplayName', 'displayName' ],
- [ 'ldapUserDisplayName2', null],
+ [ 'ldapUserDisplayName2', ''],
]);
$offlineUserMock = $this->createMock(OfflineUser::class);
diff --git a/build/integration/features/bootstrap/Avatar.php b/build/integration/features/bootstrap/Avatar.php
index 59d9ed920a1..e3ebde513a7 100644
--- a/build/integration/features/bootstrap/Avatar.php
+++ b/build/integration/features/bootstrap/Avatar.php
@@ -183,15 +183,11 @@ trait Avatar {
// on solid color images the resizing can cause some small
// artifacts that slightly modify the color of certain pixels.
if (!$this->isSameColor($firstPixelColor, $currentPixelColor)) {
- imagedestroy($image);
-
return null;
}
}
}
- imagedestroy($image);
-
return $firstPixelColor;
}
diff --git a/build/psalm-baseline.xml b/build/psalm-baseline.xml
index 8acd31877b1..803facc247a 100644
--- a/build/psalm-baseline.xml
+++ b/build/psalm-baseline.xml
@@ -3414,6 +3414,7 @@
+
diff --git a/composer.json b/composer.json
index 8fd8b0b39c5..fa0e2a6a521 100644
--- a/composer.json
+++ b/composer.json
@@ -83,9 +83,9 @@
],
"test": [
"Composer\\Config::disableProcessTimeout",
- "phpunit --fail-on-warning --fail-on-risky --display-warnings --display-deprecations --display-phpunit-deprecations --colors=always --configuration tests/phpunit-autotest.xml"
+ "phpunit --fail-on-warning --fail-on-risky --display-warnings --display-deprecations --display-phpunit-deprecations --display-skipped --colors=always --configuration tests/phpunit-autotest.xml"
],
- "test:db": "@composer run test -- --group DB --group SLOWDB",
+ "test:db": "@composer run test -- --group DB --group SLOWDB --exclude-group S3 --exclude-group PRIMARY-swift --exclude-group PRIMARY-s3 --exclude-group PRIMARY-azure",
"test:files_external": "phpunit --fail-on-warning --fail-on-risky --display-warnings --display-deprecations --display-phpunit-deprecations --colors=always --configuration tests/phpunit-autotest-external.xml",
"rector": "rector --config=build/rector.php && composer cs:fix",
"rector:strict": "rector --config=build/rector-strict.php && composer cs:fix",
diff --git a/core/Command/Background/Job.php b/core/Command/Background/Job.php
index 4ab7c930b79..f8e3df9972a 100644
--- a/core/Command/Background/Job.php
+++ b/core/Command/Background/Job.php
@@ -124,7 +124,6 @@ class Job extends Command {
if ($isTimedJob) {
$reflection = new \ReflectionClass($job);
$intervalProperty = $reflection->getProperty('interval');
- $intervalProperty->setAccessible(true);
$interval = $intervalProperty->getValue($job);
$nextRun = new \DateTime();
diff --git a/core/Command/Background/JobBase.php b/core/Command/Background/JobBase.php
index 558ccccf29d..484e2556d14 100644
--- a/core/Command/Background/JobBase.php
+++ b/core/Command/Background/JobBase.php
@@ -65,7 +65,6 @@ abstract class JobBase extends Base {
if ($isTimedJob) {
$reflection = new \ReflectionClass($job);
$intervalProperty = $reflection->getProperty('interval');
- $intervalProperty->setAccessible(true);
$interval = $intervalProperty->getValue($job);
$nextRun = new \DateTime();
diff --git a/lib/private/Authentication/Token/PublicKeyToken.php b/lib/private/Authentication/Token/PublicKeyToken.php
index e3d5e7001ff..42c186f5e33 100644
--- a/lib/private/Authentication/Token/PublicKeyToken.php
+++ b/lib/private/Authentication/Token/PublicKeyToken.php
@@ -205,6 +205,10 @@ class PublicKeyToken extends Entity implements INamedToken, IWipeableToken {
return parent::getRemember();
}
+ public function getToken(): string {
+ return parent::getToken();
+ }
+
#[\Override]
public function setToken(string $token): void {
parent::setToken($token);
diff --git a/lib/private/Authentication/Token/PublicKeyTokenProvider.php b/lib/private/Authentication/Token/PublicKeyTokenProvider.php
index a079c5e38f1..9f0d4ccbe96 100644
--- a/lib/private/Authentication/Token/PublicKeyTokenProvider.php
+++ b/lib/private/Authentication/Token/PublicKeyTokenProvider.php
@@ -531,16 +531,18 @@ class PublicKeyTokenProvider implements IProvider {
$hashNeedsUpdate = [];
foreach ($tokens as $t) {
- if (!isset($hashNeedsUpdate[$t->getPasswordHash()])) {
- if ($t->getPasswordHash() === null) {
- $hashNeedsUpdate[$t->getPasswordHash() ?: ''] = true;
- } elseif (!$this->hasher->verify(sha1($password) . $password, $t->getPasswordHash())) {
- $hashNeedsUpdate[$t->getPasswordHash() ?: ''] = true;
+ $passwordHash = $t->getPasswordHash();
+ if ($passwordHash === null) {
+ $hashNeedsUpdate[''] = true;
+ $needsUpdating = true;
+ } elseif (!isset($hashNeedsUpdate[$passwordHash])) {
+ if (!$this->hasher->verify(sha1($password) . $password, $passwordHash)) {
+ $hashNeedsUpdate[$passwordHash] = true;
} else {
- $hashNeedsUpdate[$t->getPasswordHash() ?: ''] = false;
+ $hashNeedsUpdate[$passwordHash] = false;
}
+ $needsUpdating = $hashNeedsUpdate[$passwordHash] ?? true;
}
- $needsUpdating = $hashNeedsUpdate[$t->getPasswordHash() ?: ''] ?? true;
if ($needsUpdating) {
if ($newPasswordHash === null) {
diff --git a/lib/private/Group/Manager.php b/lib/private/Group/Manager.php
index 415a38ef418..4dddfb3ed37 100644
--- a/lib/private/Group/Manager.php
+++ b/lib/private/Group/Manager.php
@@ -452,7 +452,7 @@ class Manager extends PublicEmitter implements IGroupManager {
$matchingUsers = [];
foreach ($groupUsers as $groupUser) {
- $matchingUsers[(string)$groupUser->getUID()] = $groupUser->getDisplayName();
+ $matchingUsers[$groupUser->getUID()] = $groupUser->getDisplayName();
}
return $matchingUsers;
}
diff --git a/lib/private/L10N/Factory.php b/lib/private/L10N/Factory.php
index dbf18a05c36..accdf47efe6 100644
--- a/lib/private/L10N/Factory.php
+++ b/lib/private/L10N/Factory.php
@@ -287,7 +287,7 @@ class Factory implements IFactory {
// Default : use system default locale
$defaultLocale = $this->config->getSystemValue('default_locale', false);
- if ($defaultLocale !== false && $this->localeExists($defaultLocale)) {
+ if (is_string($defaultLocale) && $this->localeExists($defaultLocale)) {
return $defaultLocale;
}
@@ -463,12 +463,8 @@ class Factory implements IFactory {
return $this->cleanLanguage($this->request->getParam('forceLanguage')) ?? $this->config->getSystemValueString('default_language', 'en');
}
- /**
- * @param string $locale
- * @return bool
- */
#[\Override]
- public function localeExists($locale) {
+ public function localeExists(string $locale): bool {
if ($locale === 'en') { //english is always available
return true;
}
diff --git a/lib/private/TempManager.php b/lib/private/TempManager.php
index f5801e5ab98..fa7f891ca92 100644
--- a/lib/private/TempManager.php
+++ b/lib/private/TempManager.php
@@ -50,13 +50,14 @@ class TempManager implements ITempManager {
$path = $this->generateTemporaryPath($postFix);
$old_umask = umask(0077);
- $fp = fopen($path, 'x');
+ $fp = @fopen($path, 'x');
umask($old_umask);
if ($fp === false) {
$this->log->warning(
'Can not create a temporary file in directory {dir}. Check it exists and has correct permissions',
[
'dir' => $this->tmpBaseDir,
+ 'error' => error_get_last(),
]
);
return false;
@@ -71,11 +72,12 @@ class TempManager implements ITempManager {
public function getTemporaryFolder($postFix = ''): string|false {
$path = $this->generateTemporaryPath($postFix) . '/';
- if (mkdir($path, 0700) === false) {
+ if (@mkdir($path, 0700) === false) {
$this->log->warning(
'Can not create a temporary folder in directory {dir}. Check it exists and has correct permissions',
[
'dir' => $this->tmpBaseDir,
+ 'error' => error_get_last(),
]
);
return false;
diff --git a/lib/private/User/LazyUser.php b/lib/private/User/LazyUser.php
index 3ae6a557a2d..8a010782a03 100644
--- a/lib/private/User/LazyUser.php
+++ b/lib/private/User/LazyUser.php
@@ -1,6 +1,7 @@
displayName) {
return $this->displayName;
}
@@ -56,7 +58,7 @@ class LazyUser implements IUser {
}
#[\Override]
- public function setDisplayName($displayName) {
+ public function setDisplayName($displayName): bool {
return $this->getUser()->setDisplayName($displayName);
}
@@ -76,12 +78,12 @@ class LazyUser implements IUser {
}
#[\Override]
- public function delete() {
+ public function delete(): bool {
return $this->getUser()->delete();
}
#[\Override]
- public function setPassword($password, $recoveryPassword = null) {
+ public function setPassword($password, $recoveryPassword = null): bool {
return $this->getUser()->setPassword($password, $recoveryPassword);
}
@@ -96,12 +98,12 @@ class LazyUser implements IUser {
}
#[\Override]
- public function getHome() {
+ public function getHome(): string {
return $this->getUser()->getHome();
}
#[\Override]
- public function getBackendClassName() {
+ public function getBackendClassName(): string {
return $this->getUser()->getBackendClassName();
}
@@ -136,17 +138,17 @@ class LazyUser implements IUser {
}
#[\Override]
- public function isEnabled() {
+ public function isEnabled(): bool {
return $this->getUser()->isEnabled();
}
#[\Override]
- public function setEnabled(bool $enabled = true) {
- return $this->getUser()->setEnabled($enabled);
+ public function setEnabled(bool $enabled = true): void {
+ $this->getUser()->setEnabled($enabled);
}
#[\Override]
- public function getEMailAddress() {
+ public function getEMailAddress(): ?string {
return $this->getUser()->getEMailAddress();
}
@@ -161,17 +163,17 @@ class LazyUser implements IUser {
}
#[\Override]
- public function getAvatarImage($size) {
+ public function getAvatarImage($size): ?IImage {
return $this->getUser()->getAvatarImage($size);
}
#[\Override]
- public function getCloudId() {
+ public function getCloudId(): string {
return $this->getUser()->getCloudId();
}
#[\Override]
- public function setEMailAddress($mailAddress) {
+ public function setEMailAddress($mailAddress): void {
$this->getUser()->setEMailAddress($mailAddress);
}
@@ -186,7 +188,7 @@ class LazyUser implements IUser {
}
#[\Override]
- public function getQuota() {
+ public function getQuota(): string {
return $this->getUser()->getQuota();
}
@@ -196,7 +198,7 @@ class LazyUser implements IUser {
}
#[\Override]
- public function setQuota($quota) {
+ public function setQuota($quota): void {
$this->getUser()->setQuota($quota);
}
diff --git a/lib/private/User/User.php b/lib/private/User/User.php
index d22b8ae89a4..e54ac397b3e 100644
--- a/lib/private/User/User.php
+++ b/lib/private/User/User.php
@@ -481,11 +481,9 @@ class User implements IUser {
/**
* set the enabled status for the user
- *
- * @return void
*/
#[\Override]
- public function setEnabled(bool $enabled = true) {
+ public function setEnabled(bool $enabled = true): void {
$oldStatus = $this->isEnabled();
$setDatabaseValue = function (bool $enabled): void {
$this->config->setUserValue($this->uid, 'core', 'enabled', $enabled ? 'true' : 'false');
@@ -524,18 +522,12 @@ class User implements IUser {
return $this->getPrimaryEMailAddress() ?? $this->getSystemEMailAddress();
}
- /**
- * @inheritDoc
- */
#[\Override]
public function getSystemEMailAddress(): ?string {
$email = $this->config->getUserValue($this->uid, 'settings', 'email', null);
return $email ? mb_strtolower(trim($email)) : null;
}
- /**
- * @inheritDoc
- */
#[\Override]
public function getPrimaryEMailAddress(): ?string {
$email = $this->config->getUserValue($this->uid, 'settings', 'primary_email', null);
diff --git a/lib/private/legacy/OC_Util.php b/lib/private/legacy/OC_Util.php
index 4658cfaca52..3e4b7a7fe9d 100644
--- a/lib/private/legacy/OC_Util.php
+++ b/lib/private/legacy/OC_Util.php
@@ -315,7 +315,14 @@ class OC_Util {
[$urlGenerator->linkToDocs('admin-dir_permissions')])
];
}
- } elseif (!is_writable($CONFIG_DATADIRECTORY) || !is_readable($CONFIG_DATADIRECTORY)) {
+ } elseif (!is_readable($CONFIG_DATADIRECTORY)) {
+ $permissionsHint = $l->t('Permissions can usually be fixed by giving the web server write access to the root directory. See %s.',
+ [$urlGenerator->linkToDocs('admin-dir_permissions')]);
+ $errors[] = [
+ 'error' => $l->t('Your data directory is not readable.'),
+ 'hint' => $permissionsHint
+ ];
+ } elseif (!is_writable($CONFIG_DATADIRECTORY)) {
// is_writable doesn't work for NFS mounts, so try to write a file and check if it exists.
$testFile = sprintf('%s/%s.tmp', $CONFIG_DATADIRECTORY, uniqid('data_dir_writability_test_'));
$handle = fopen($testFile, 'w');
diff --git a/lib/public/Cache/CappedMemoryCache.php b/lib/public/Cache/CappedMemoryCache.php
index a071d7a9cb9..40a4d26cbbe 100644
--- a/lib/public/Cache/CappedMemoryCache.php
+++ b/lib/public/Cache/CappedMemoryCache.php
@@ -1,5 +1,7 @@
+ * @template-implements \ArrayAccess
*/
class CappedMemoryCache implements ICache, \ArrayAccess {
private int $capacity;
@@ -37,7 +39,7 @@ class CappedMemoryCache implements ICache, \ArrayAccess {
* @since 25.0.0
*/
#[\Override]
- public function hasKey($key): bool {
+ public function hasKey(string|int $key): bool {
return isset($this->cache[$key]);
}
@@ -46,25 +48,18 @@ class CappedMemoryCache implements ICache, \ArrayAccess {
* @since 25.0.0
*/
#[\Override]
- public function get($key) {
+ public function get(string|int $key) {
return $this->cache[$key] ?? null;
}
/**
* @inheritdoc
- * @param string $key
* @param T $value
- * @param int $ttl
* @since 25.0.0
- * @return bool
*/
#[\Override]
- public function set($key, $value, $ttl = 0): bool {
- if (is_null($key)) {
- $this->cache[] = $value;
- } else {
- $this->cache[$key] = $value;
- }
+ public function set(string|int $key, $value, int $ttl = 0): bool {
+ $this->cache[$key] = $value;
$this->garbageCollect();
return true;
}
@@ -73,7 +68,7 @@ class CappedMemoryCache implements ICache, \ArrayAccess {
* @since 25.0.0
*/
#[\Override]
- public function remove($key): bool {
+ public function remove(string|int $key): bool {
unset($this->cache[$key]);
return true;
}
@@ -83,7 +78,7 @@ class CappedMemoryCache implements ICache, \ArrayAccess {
* @since 25.0.0
*/
#[\Override]
- public function clear($prefix = ''): bool {
+ public function clear(string $prefix = ''): bool {
$this->cache = [];
return true;
}
diff --git a/lib/public/IAddressBook.php b/lib/public/IAddressBook.php
index 5a5cc487cee..cd7a13e27d4 100644
--- a/lib/public/IAddressBook.php
+++ b/lib/public/IAddressBook.php
@@ -18,8 +18,9 @@ namespace OCP {
/**
* @return string defining the technical unique key
* @since 5.0.0
+ * @since 35.0.0 Typed return type
*/
- public function getKey();
+ public function getKey(): string;
/**
* @return string defining the unique uri
diff --git a/lib/public/ICache.php b/lib/public/ICache.php
index 5e755d81e14..8fd9fea7e60 100644
--- a/lib/public/ICache.php
+++ b/lib/public/ICache.php
@@ -1,5 +1,7 @@
method('getProperty')
->with('UID')
->willReturn('member1');
- $entries[0]->method('getProperty')
+ $entries[1]->method('getProperty')
->with('UID')
->willReturn('member2');
diff --git a/tests/data/guest_avatar_einstein_32.png b/tests/data/guest_avatar_einstein_32.png
index d280dadcc8d..d03f0509bac 100644
Binary files a/tests/data/guest_avatar_einstein_32.png and b/tests/data/guest_avatar_einstein_32.png differ
diff --git a/tests/lib/Archive/TestBase.php b/tests/lib/Archive/TestBase.php
index 24b518104d5..fc5ad22c8f3 100644
--- a/tests/lib/Archive/TestBase.php
+++ b/tests/lib/Archive/TestBase.php
@@ -139,11 +139,9 @@ abstract class TestBase extends \Test\TestCase {
$this->assertFalse($this->instance->fileExists('target.txt'));
}
public function testRecursive(): void {
- $dir = \OC::$SERVERROOT . '/tests/data';
+ $dir = \OC::$SERVERROOT . '/tests/data/themes';
$this->instance = $this->getNew();
$this->instance->addRecursive('/dir', $dir);
- $this->assertTrue($this->instance->fileExists('/dir/lorem.txt'));
- $this->assertTrue($this->instance->fileExists('/dir/data.zip'));
- $this->assertTrue($this->instance->fileExists('/dir/data.tar.gz'));
+ $this->assertTrue($this->instance->fileExists('/dir/abc/apps/files/l10n/zz.json'));
}
}
diff --git a/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php b/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php
index 1c4bfba202d..1e65b53f8f9 100644
--- a/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php
+++ b/tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php
@@ -30,36 +30,25 @@ use Psr\Log\LoggerInterface;
use Test\TestCase;
class PublicKeyTokenProviderTest extends TestCase {
- /** @var PublicKeyTokenProvider|\PHPUnit\Framework\MockObject\MockObject */
- private $tokenProvider;
- /** @var PublicKeyTokenMapper|\PHPUnit\Framework\MockObject\MockObject */
- private $mapper;
- /** @var IHasher|\PHPUnit\Framework\MockObject\MockObject */
- private $hasher;
- /** @var ICrypto */
- private $crypto;
- /** @var IConfig|\PHPUnit\Framework\MockObject\MockObject */
- private $config;
- /** @var IDBConnection|MockObject */
- private IDBConnection $db;
- /** @var LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */
- private $logger;
- /** @var ITimeFactory|\PHPUnit\Framework\MockObject\MockObject */
- private $timeFactory;
- /** @var ICacheFactory|\PHPUnit\Framework\MockObject\MockObject */
- private $cacheFactory;
- /** @var int */
- private $time;
- /** @var IEventDispatcher */
- private $eventDispatcher;
+ private PublicKeyTokenProvider $tokenProvider;
+
+ private PublicKeyTokenMapper&MockObject $mapper;
+ private IConfig&MockObject $config;
+ private IDBConnection&MockObject $db;
+ private LoggerInterface&MockObject $logger;
+ private ITimeFactory&MockObject $timeFactory;
+ private ICacheFactory&MockObject $cacheFactory;
+
+ private int $time;
+ private IHasher $hasher;
+ private ICrypto $crypto;
+ private IEventDispatcher $eventDispatcher;
#[\Override]
protected function setUp(): void {
parent::setUp();
$this->mapper = $this->createMock(PublicKeyTokenMapper::class);
- $this->hasher = Server::get(IHasher::class);
- $this->crypto = Server::get(ICrypto::class);
$this->config = $this->createMock(IConfig::class);
$this->config->method('getSystemValue')
->willReturnMap([
@@ -76,6 +65,9 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->timeFactory->method('getTime')
->willReturn($this->time);
$this->cacheFactory = $this->createMock(ICacheFactory::class);
+
+ $this->hasher = Server::get(IHasher::class);
+ $this->crypto = Server::get(ICrypto::class);
$this->eventDispatcher = Server::get(IEventDispatcher::class);
$this->tokenProvider = new PublicKeyTokenProvider(
@@ -186,6 +178,7 @@ class PublicKeyTokenProviderTest extends TestCase {
->method('updateActivity')
->with($tk, $this->time);
$tk->setLastActivity($this->time - 200);
+ $tk->setToken('token');
$this->config->method('getSystemValueBool')
->willReturnMap([
['auth.storeCryptedPassword', true, true],
@@ -448,6 +441,7 @@ class PublicKeyTokenProviderTest extends TestCase {
public function testGetToken(): void {
$token = new PublicKeyToken();
+ $token->setToken('token');
$this->config->method('getSystemValue')
->with('secret')
@@ -595,6 +589,9 @@ class PublicKeyTokenProviderTest extends TestCase {
public function testMarkPasswordInvalid(): void {
$token = $this->createMock(PublicKeyToken::class);
+ $token->expects($this->once())
+ ->method('getToken')
+ ->willReturn('token');
$token->expects($this->once())
->method('setPasswordInvalid')
diff --git a/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php b/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php
index e919d099132..9c751d487c1 100644
--- a/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php
+++ b/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php
@@ -31,53 +31,30 @@ use Test\TestCase;
use function reset;
class ManagerTest extends TestCase {
- /** @var IUser|MockObject */
- private $user;
+ private IUser&MockObject $user;
+ private ProviderLoader&MockObject $providerLoader;
+ private IRegistry&MockObject $providerRegistry;
+ private MandatoryTwoFactor&MockObject $mandatoryTwoFactor;
+ private ISession&MockObject $session;
+ private IConfig&MockObject $config;
+ private IManager&MockObject $activityManager;
+ private LoggerInterface&MockObject $logger;
+ private IProvider&MockObject $fakeProvider;
+ private IProvider&MockObject $backupProvider;
+ private TokenProvider&MockObject $tokenProvider;
+ private ITimeFactory&MockObject $timeFactory;
+ private IEventDispatcher&MockObject $dispatcher;
- /** @var ProviderLoader|MockObject */
- private $providerLoader;
-
- /** @var IRegistry|MockObject */
- private $providerRegistry;
-
- /** @var MandatoryTwoFactor|MockObject */
- private $mandatoryTwoFactor;
-
- /** @var ISession|MockObject */
- private $session;
-
- /** @var Manager */
- private $manager;
-
- /** @var IConfig|MockObject */
- private $config;
-
- /** @var IManager|MockObject */
- private $activityManager;
-
- /** @var LoggerInterface|MockObject */
- private $logger;
-
- /** @var IProvider|MockObject */
- private $fakeProvider;
-
- /** @var IProvider|MockObject */
- private $backupProvider;
-
- /** @var TokenProvider|MockObject */
- private $tokenProvider;
-
- /** @var ITimeFactory|MockObject */
- private $timeFactory;
-
- /** @var IEventDispatcher|MockObject */
- private $dispatcher;
+ private Manager $manager;
#[\Override]
protected function setUp(): void {
parent::setUp();
$this->user = $this->createMock(IUser::class);
+ $this->user->expects($this->any())
+ ->method('getUID')
+ ->willReturn('user-uid');
$this->providerLoader = $this->createMock(ProviderLoader::class);
$this->providerRegistry = $this->createMock(IRegistry::class);
$this->mandatoryTwoFactor = $this->createMock(MandatoryTwoFactor::class);
@@ -371,15 +348,12 @@ class ManagerTest extends TestCase {
$this->session->expects($this->once())
->method('set')
- ->with(Manager::SESSION_UID_DONE, 'jos');
+ ->with(Manager::SESSION_UID_DONE, $this->user->getUID());
$this->session->method('getId')
->willReturn('mysessionid');
$this->activityManager->expects($this->once())
->method('generateEvent')
->willReturn($event);
- $this->user->expects($this->any())
- ->method('getUID')
- ->willReturn('jos');
$event->expects($this->once())
->method('setApp')
->with($this->equalTo('core'))
@@ -390,11 +364,11 @@ class ManagerTest extends TestCase {
->willReturnSelf();
$event->expects($this->once())
->method('setAuthor')
- ->with($this->equalTo('jos'))
+ ->with($this->equalTo($this->user->getUID()))
->willReturnSelf();
$event->expects($this->once())
->method('setAffectedUser')
- ->with($this->equalTo('jos'))
+ ->with($this->equalTo($this->user->getUID()))
->willReturnSelf();
$this->fakeProvider
->method('getDisplayName')
@@ -413,7 +387,7 @@ class ManagerTest extends TestCase {
->willReturn(42);
$this->config->expects($this->once())
->method('deleteUserValue')
- ->with('jos', 'login_token_2fa', '42');
+ ->with($this->user->getUID(), 'login_token_2fa', '42');
$result = $this->manager->verifyChallenge('email', $this->user, $challenge);
@@ -447,9 +421,6 @@ class ManagerTest extends TestCase {
$this->activityManager->expects($this->once())
->method('generateEvent')
->willReturn($event);
- $this->user->expects($this->any())
- ->method('getUID')
- ->willReturn('jos');
$event->expects($this->once())
->method('setApp')
->with($this->equalTo('core'))
@@ -460,11 +431,11 @@ class ManagerTest extends TestCase {
->willReturnSelf();
$event->expects($this->once())
->method('setAuthor')
- ->with($this->equalTo('jos'))
+ ->with($this->equalTo($this->user->getUID()))
->willReturnSelf();
$event->expects($this->once())
->method('setAffectedUser')
- ->with($this->equalTo('jos'))
+ ->with($this->equalTo($this->user->getUID()))
->willReturnSelf();
$this->fakeProvider
->method('getDisplayName')
@@ -559,11 +530,8 @@ class ManagerTest extends TestCase {
}
public function testPrepareTwoFactorLogin(): void {
- $this->user->method('getUID')
- ->willReturn('ferdinand');
-
$calls = [
- ['two_factor_auth_uid', 'ferdinand'],
+ ['two_factor_auth_uid', $this->user->getUID()],
['two_factor_remember_login', true],
];
$this->session->expects($this->exactly(2))
@@ -586,17 +554,14 @@ class ManagerTest extends TestCase {
->willReturn(1337);
$this->config->method('setUserValue')
- ->with('ferdinand', 'login_token_2fa', '42', '1337');
+ ->with($this->user->getUID(), 'login_token_2fa', '42', '1337');
$this->manager->prepareTwoFactorLogin($this->user, true);
}
public function testPrepareTwoFactorLoginDontRemember(): void {
- $this->user->method('getUID')
- ->willReturn('ferdinand');
-
$calls = [
- ['two_factor_auth_uid', 'ferdinand'],
+ ['two_factor_auth_uid', $this->user->getUID()],
['two_factor_remember_login', false],
];
$this->session->expects($this->exactly(2))
@@ -619,7 +584,7 @@ class ManagerTest extends TestCase {
->willReturn(1337);
$this->config->method('setUserValue')
- ->with('ferdinand', 'login_token_2fa', '42', '1337');
+ ->with($this->user->getUID(), 'login_token_2fa', '42', '1337');
$this->manager->prepareTwoFactorLogin($this->user, false);
}
diff --git a/tests/lib/Avatar/GuestAvatarTest.php b/tests/lib/Avatar/GuestAvatarTest.php
index aa4c59d9ba7..c50b4b2066b 100644
--- a/tests/lib/Avatar/GuestAvatarTest.php
+++ b/tests/lib/Avatar/GuestAvatarTest.php
@@ -45,7 +45,6 @@ class GuestAvatarTest extends TestCase {
* the generated image is compared with an expected one.
*/
public function testGet(): void {
- $this->markTestSkipped('TODO: Disable because fails on drone');
$avatar = $this->guestAvatar->getFile(32);
self::assertInstanceOf(InMemoryFile::class, $avatar);
$expectedFile = file_get_contents(
diff --git a/tests/lib/Contacts/ContactsMenu/Providers/LocalTimeProviderTest.php b/tests/lib/Contacts/ContactsMenu/Providers/LocalTimeProviderTest.php
index a36416ca9ea..e595af8e035 100644
--- a/tests/lib/Contacts/ContactsMenu/Providers/LocalTimeProviderTest.php
+++ b/tests/lib/Contacts/ContactsMenu/Providers/LocalTimeProviderTest.php
@@ -186,10 +186,6 @@ class LocalTimeProviderTest extends TestCase {
->with('UID')
->willReturn('user1');
- $user = $this->createMock(IUser::class);
- $user->method('getUID')
- ->willReturn(null);
-
$entry->expects($this->never())
->method('addAction');
diff --git a/tests/lib/DB/QueryBuilder/QueryBuilderTest.php b/tests/lib/DB/QueryBuilder/QueryBuilderTest.php
index 1b54a8c946f..e39ba0b78c6 100644
--- a/tests/lib/DB/QueryBuilder/QueryBuilderTest.php
+++ b/tests/lib/DB/QueryBuilder/QueryBuilderTest.php
@@ -531,8 +531,8 @@ class QueryBuilderTest extends \Test\TestCase {
public static function dataJoin(): array {
return [
[
- 'd1', 'data2', null, null,
- ['`d1`' => [['joinType' => 'inner', 'joinTable' => '`*PREFIX*data2`', 'joinAlias' => null, 'joinCondition' => null]]],
+ 'd1', 'data2', '', null,
+ ['`d1`' => [['joinType' => 'inner', 'joinTable' => '`*PREFIX*data2`', 'joinAlias' => '', 'joinCondition' => null]]],
'`*PREFIX*data1` `d1` INNER JOIN `*PREFIX*data2` '
],
[
@@ -611,8 +611,8 @@ class QueryBuilderTest extends \Test\TestCase {
public static function dataLeftJoin(): array {
return [
[
- 'd1', 'data2', null, null,
- ['`d1`' => [['joinType' => 'left', 'joinTable' => '`*PREFIX*data2`', 'joinAlias' => null, 'joinCondition' => null]]],
+ 'd1', 'data2', '', null,
+ ['`d1`' => [['joinType' => 'left', 'joinTable' => '`*PREFIX*data2`', 'joinAlias' => '', 'joinCondition' => null]]],
'`*PREFIX*data1` `d1` LEFT JOIN `*PREFIX*data2` '
],
[
@@ -661,8 +661,8 @@ class QueryBuilderTest extends \Test\TestCase {
public static function dataRightJoin(): array {
return [
[
- 'd1', 'data2', null, null,
- ['`d1`' => [['joinType' => 'right', 'joinTable' => '`*PREFIX*data2`', 'joinAlias' => null, 'joinCondition' => null]]],
+ 'd1', 'data2', '', null,
+ ['`d1`' => [['joinType' => 'right', 'joinTable' => '`*PREFIX*data2`', 'joinAlias' => '', 'joinCondition' => null]]],
'`*PREFIX*data1` `d1` RIGHT JOIN `*PREFIX*data2` '
],
[
@@ -678,17 +678,15 @@ class QueryBuilderTest extends \Test\TestCase {
];
}
- /**
- *
- * @param string $fromAlias
- * @param string $tableName
- * @param string $tableAlias
- * @param string $condition
- * @param array $expectedQueryPart
- * @param string $expectedQuery
- */
#[DataProvider('dataRightJoin')]
- public function testRightJoin($fromAlias, $tableName, $tableAlias, $condition, $expectedQueryPart, $expectedQuery): void {
+ public function testRightJoin(
+ string $fromAlias,
+ string $tableName,
+ string $tableAlias,
+ ?string $condition,
+ array $expectedQueryPart,
+ string $expectedQuery,
+ ): void {
$this->queryBuilder->from('data1', 'd1');
$this->queryBuilder->rightJoin(
$fromAlias,
diff --git a/tests/lib/Files/Mount/RootMountProviderTest.php b/tests/lib/Files/Mount/RootMountProviderTest.php
index 8a61dc81034..22491285fb0 100644
--- a/tests/lib/Files/Mount/RootMountProviderTest.php
+++ b/tests/lib/Files/Mount/RootMountProviderTest.php
@@ -85,7 +85,6 @@ class RootMountProviderTest extends TestCase {
$class = new \ReflectionClass($storage);
$prop = $class->getProperty('objectStore');
- $prop->setAccessible(true);
/** @var S3 $objectStore */
$objectStore = $prop->getValue($storage);
$this->assertEquals('nextcloud', $objectStore->getBucket());
diff --git a/tests/lib/Files/Stream/EncryptionTest.php b/tests/lib/Files/Stream/EncryptionTest.php
index 13f14bbc324..b397019df93 100644
--- a/tests/lib/Files/Stream/EncryptionTest.php
+++ b/tests/lib/Files/Stream/EncryptionTest.php
@@ -149,29 +149,17 @@ class EncryptionTest extends \Test\TestCase {
// set internal properties of the stream wrapper
$stream = new \ReflectionClass(Encryption::class);
$encryptionModule = $stream->getProperty('encryptionModule');
- $encryptionModule->setAccessible(true);
$encryptionModule->setValue($streamWrapper, $encryptionModuleMock);
- $encryptionModule->setAccessible(false);
$storage = $stream->getProperty('storage');
- $storage->setAccessible(true);
$storage->setValue($streamWrapper, $storageMock);
- $storage->setAccessible(false);
$file = $stream->getProperty('file');
- $file->setAccessible(true);
$file->setValue($streamWrapper, $fileMock);
- $file->setAccessible(false);
$util = $stream->getProperty('util');
- $util->setAccessible(true);
$util->setValue($streamWrapper, $utilMock);
- $util->setAccessible(false);
$fullPathP = $stream->getProperty('fullPath');
- $fullPathP->setAccessible(true);
$fullPathP->setValue($streamWrapper, $fullPath);
- $fullPathP->setAccessible(false);
$header = $stream->getProperty('header');
- $header->setAccessible(true);
$header->setValue($streamWrapper, []);
- $header->setAccessible(false);
$this->invokePrivate($streamWrapper, 'signed', [true]);
$this->invokePrivate($streamWrapper, 'internalPath', [$fullPath]);
$this->invokePrivate($streamWrapper, 'uid', ['test']);
@@ -182,19 +170,13 @@ class EncryptionTest extends \Test\TestCase {
// check internal properties
$size = $stream->getProperty('size');
- $size->setAccessible(true);
$this->assertSame($expectedSize, $size->getValue($streamWrapper));
- $size->setAccessible(false);
$unencryptedSize = $stream->getProperty('unencryptedSize');
- $unencryptedSize->setAccessible(true);
$this->assertSame($expectedUnencryptedSize, $unencryptedSize->getValue($streamWrapper));
- $unencryptedSize->setAccessible(false);
$readOnly = $stream->getProperty('readOnly');
- $readOnly->setAccessible(true);
$this->assertSame($expectedReadOnly, $readOnly->getValue($streamWrapper));
- $readOnly->setAccessible(false);
}
public static function dataProviderStreamOpen(): array {
diff --git a/tests/lib/TaskProcessing/TaskProcessingTest.php b/tests/lib/TaskProcessing/TaskProcessingTest.php
index c415b923bf5..59a0ba1d237 100644
--- a/tests/lib/TaskProcessing/TaskProcessingTest.php
+++ b/tests/lib/TaskProcessing/TaskProcessingTest.php
@@ -913,7 +913,7 @@ class TaskProcessingTest extends \Test\TestCase {
new ServiceRegistration('test', AsyncProvider::class)
]);
$user = $this->createMock(IUser::class);
- $user->expects($this->any())->method('getUID')->willReturn(null);
+ $user->expects($this->any())->method('getUID')->willReturn('uid');
$mount = $this->createMock(ICachedMountInfo::class);
$mount->expects($this->any())->method('getUser')->willReturn($user);
$this->userMountCache->expects($this->any())->method('getMountsForFileId')->willReturn([$mount]);
diff --git a/tests/lib/TempManagerTest.php b/tests/lib/TempManagerTest.php
index e63ad7d3cd9..06a43930e91 100644
--- a/tests/lib/TempManagerTest.php
+++ b/tests/lib/TempManagerTest.php
@@ -36,12 +36,7 @@ class TempManagerTest extends \Test\TestCase {
parent::tearDown();
}
- /**
- * @param ?LoggerInterface $logger
- * @param ?IConfig $config
- * @return TempManager
- */
- protected function getManager($logger = null, $config = null) {
+ protected function getManager(?LoggerInterface $logger = null, ?IConfig $config = null): TempManager {
if (!$logger) {
$logger = $this->createMock(LoggerInterface::class);
}
@@ -49,7 +44,7 @@ class TempManagerTest extends \Test\TestCase {
$config = $this->createMock(IConfig::class);
$config->method('getSystemValue')
->with('tempdirectory', null)
- ->willReturn('/tmp');
+ ->willReturn('/dev/shm');
}
$iniGetWrapper = $this->createMock(IniGetWrapper::class);
$manager = new TempManager($logger, $config, $iniGetWrapper);
@@ -135,8 +130,6 @@ class TempManagerTest extends \Test\TestCase {
}
public function testLogCantCreateFile(): void {
- $this->markTestSkipped('TODO: Disable because fails on drone');
-
$logger = $this->createMock(LoggerInterface::class);
$manager = $this->getManager($logger);
chmod($this->baseDir, 0500);
@@ -147,8 +140,6 @@ class TempManagerTest extends \Test\TestCase {
}
public function testLogCantCreateFolder(): void {
- $this->markTestSkipped('TODO: Disable because fails on drone');
-
$logger = $this->createMock(LoggerInterface::class);
$manager = $this->getManager($logger);
chmod($this->baseDir, 0500);
diff --git a/tests/lib/Template/ResourceLocatorTest.php b/tests/lib/Template/ResourceLocatorTest.php
index ab5c780ec61..3244250f2fd 100644
--- a/tests/lib/Template/ResourceLocatorTest.php
+++ b/tests/lib/Template/ResourceLocatorTest.php
@@ -73,7 +73,6 @@ class ResourceLocatorTest extends \Test\TestCase {
public function testAppendIfExist(): void {
$locator = $this->getResourceLocator('theme');
$method = new \ReflectionMethod($locator, 'appendIfExist');
- $method->setAccessible(true);
$method->invoke($locator, __DIR__, basename(__FILE__), 'webroot');
$resource1 = [__DIR__, 'webroot', basename(__FILE__)];
diff --git a/tests/lib/UtilCheckServerTest.php b/tests/lib/UtilCheckServerTest.php
index fade2f6d341..712235f5599 100644
--- a/tests/lib/UtilCheckServerTest.php
+++ b/tests/lib/UtilCheckServerTest.php
@@ -148,11 +148,9 @@ class UtilCheckServerTest extends \Test\TestCase {
}
/**
- * Tests an error is given when the datadir is not writable
+ * Tests an error is given when the datadir is not readable
*/
- public function testDataDirNotWritable(): void {
- $this->markTestSkipped('TODO: Disable because fails on drone');
-
+ public function testDataDirNotReadable(): void {
chmod($this->datadir, 0300);
$result = \OC_Util::checkServer($this->getConfig([
'installed' => true,
@@ -165,7 +163,7 @@ class UtilCheckServerTest extends \Test\TestCase {
* Tests no error is given when the datadir is not writable during setup
*/
public function testDataDirNotWritableSetup(): void {
- chmod($this->datadir, 0300);
+ chmod($this->datadir, 0500);
$result = \OC_Util::checkServer($this->getConfig([
'installed' => false,
'version' => implode('.', Util::getVersion())
diff --git a/tests/phpunit-autotest.xml b/tests/phpunit-autotest.xml
index 11dd78dc809..94f8e0a9787 100644
--- a/tests/phpunit-autotest.xml
+++ b/tests/phpunit-autotest.xml
@@ -18,6 +18,8 @@
Core/
../apps/
../apps/user_ldap/tests/Integration
+
+ ../apps/files_external
@@ -27,7 +29,7 @@
../3rdparty
../apps/*/composer
../apps/*/tests
- ../apps/files_external/3rdparty
+ ../apps/files_external
../build
../lib/composer
../tests
diff --git a/tests/preseed-config.php b/tests/preseed-config.php
index 1fc98a4226a..0853b220a65 100644
--- a/tests/preseed-config.php
+++ b/tests/preseed-config.php
@@ -16,6 +16,7 @@ $CONFIG = [
'writable' => true,
],
],
+ 'tempdirectory' => '/dev/shm',
];
if (is_dir(OC::$SERVERROOT . '/apps2')) {