Merge pull request #61140 from nextcloud/fix/fix-deprecations-in-tests

Fix deprecations in tests
This commit is contained in:
Louis 2026-06-11 14:48:10 +02:00 committed by GitHub
commit da706223e4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
54 changed files with 210 additions and 289 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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 }}

View file

@ -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()

View file

@ -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

View file

@ -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

View file

@ -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 }}

View file

@ -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'];
}

View file

@ -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',
];

View file

@ -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);

View file

@ -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')

View file

@ -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');

View file

@ -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

View file

@ -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 {

View file

@ -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) {

View file

@ -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
''
],
];
}

View file

@ -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() {

View file

@ -712,7 +712,7 @@ class AccessTest extends TestCase {
->method('__get')
->willReturnMap([
[ 'ldapUserDisplayName', 'displayName' ],
[ 'ldapUserDisplayName2', null],
[ 'ldapUserDisplayName2', ''],
]);
$offlineUserMock = $this->createMock(OfflineUser::class);

View file

@ -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;
}

View file

@ -3414,6 +3414,7 @@
<code><![CDATA[getPassword]]></code>
<code><![CDATA[getRemember]]></code>
<code><![CDATA[getScope]]></code>
<code><![CDATA[getToken]]></code>
<code><![CDATA[setExpires]]></code>
<code><![CDATA[setLastCheck]]></code>
<code><![CDATA[setName]]></code>

View file

@ -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",

View file

@ -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();

View file

@ -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();

View file

@ -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);

View file

@ -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) {

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;

View file

@ -1,6 +1,7 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
@ -8,6 +9,7 @@ declare(strict_types=1);
namespace OC\User;
use OCP\IImage;
use OCP\IUser;
use OCP\IUserManager;
use OCP\UserInterface;
@ -47,7 +49,7 @@ class LazyUser implements IUser {
}
#[\Override]
public function getDisplayName() {
public function getDisplayName(): string {
if ($this->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);
}

View file

@ -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);

View file

@ -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');

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2022-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@ -17,7 +19,7 @@ use OCP\ICache;
*
* @since 25.0.0
* @template T
* @template-implements \ArrayAccess<string,T>
* @template-implements \ArrayAccess<array-key,T>
*/
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;
}

View file

@ -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

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
@ -22,46 +24,41 @@ interface ICache {
/**
* Get a value from the user cache
* @param string $key
* @return mixed
* @since 6.0.0
*/
public function get($key);
public function get(string $key);
/**
* Set a value in the user cache
* @param string $key
* @param mixed $value
* @param int $ttl Time To Live in seconds. Defaults to 60*60*24
* @return bool
* @since 6.0.0
*/
public function set($key, $value, $ttl = 0);
public function set(string $key, $value, int $ttl = 0);
/**
* Check if a value is set in the user cache
* @param string $key
* @return bool
* @since 6.0.0
* @deprecated 9.1.0 Directly read from GET to prevent race conditions
*/
public function hasKey($key);
public function hasKey(string $key);
/**
* Remove an item from the user cache
* @param string $key
* @return bool
* @since 6.0.0
*/
public function remove($key);
public function remove(string $key);
/**
* Clear the user cache of all entries starting with a prefix
* @param string $prefix (optional)
* @return bool
* @since 6.0.0
*/
public function clear($prefix = '');
public function clear(string $prefix = '');
/**
* Check if the cache implementation is available

View file

@ -27,36 +27,31 @@ interface IUser {
/**
* get the user id
*
* @return string
* @since 8.0.0
*/
public function getUID();
public function getUID(): string;
/**
* get the display name for the user, if no specific display name is set it will fallback to the user id
*
* @return string
* @since 8.0.0
*/
public function getDisplayName();
public function getDisplayName(): string;
/**
* set the display name for the user
*
* @param string $displayName
* @return bool
* @since 8.0.0
*
* @since 25.0.0 Throw InvalidArgumentException
* @throws \InvalidArgumentException
*/
public function setDisplayName($displayName);
public function setDisplayName(string $displayName): bool;
/**
* returns the timestamp of the user's last login or 0 if the user did never
* login
*
* @return int
* @since 8.0.0
*/
public function getLastLogin(): int;
@ -79,20 +74,18 @@ interface IUser {
/**
* Delete the user
*
* @return bool
* @since 8.0.0
*/
public function delete();
public function delete(): bool;
/**
* Set the password of the user
*
* @param string $password
* @param string $recoveryPassword for the encryption app to reset encryption keys
* @return bool
* @since 8.0.0
*/
public function setPassword($password, $recoveryPassword = null);
public function setPassword($password, $recoveryPassword = null): bool;
/**
* Get the password hash of the user
@ -114,25 +107,23 @@ interface IUser {
/**
* get the users home folder to mount
*
* @return string
* @since 8.0.0
*/
public function getHome();
public function getHome(): string;
/**
* Get the name of the backend class the user is connected with
*
* @return string
* @since 8.0.0
*/
public function getBackendClassName();
public function getBackendClassName(): string;
/**
* Get the backend for the current user object
* @return ?UserInterface
*
* @since 15.0.0
*/
public function getBackend();
public function getBackend(): ?UserInterface;
/**
* check if the backend allows the user to change their avatar on Personal page
@ -171,26 +162,23 @@ interface IUser {
/**
* check if the user is enabled
*
* @return bool
* @since 8.0.0
*/
public function isEnabled();
public function isEnabled(): bool;
/**
* set the enabled status for the user
*
* @param bool $enabled
* @since 8.0.0
*/
public function setEnabled(bool $enabled = true);
public function setEnabled(bool $enabled = true): void;
/**
* get the user's email address
*
* @return string|null
* @since 9.0.0
*/
public function getEMailAddress();
public function getEMailAddress(): ?string;
/**
* get the user's system email address
@ -201,7 +189,6 @@ interface IUser {
* Use this getter only when the system address is needed. For picking the
* proper address to e.g. send a mail to, use getEMailAddress().
*
* @return string|null
* @since 23.0.0
*/
public function getSystemEMailAddress(): ?string;
@ -216,7 +203,6 @@ interface IUser {
* Use this getter only when the primary address is needed. For picking the
* proper address to e.g. send a mail to, use getEMailAddress().
*
* @return string|null
* @since 23.0.0
*/
public function getPrimaryEMailAddress(): ?string;
@ -225,10 +211,9 @@ interface IUser {
* get the avatar image if it exists
*
* @param int $size
* @return IImage|null
* @since 9.0.0
*/
public function getAvatarImage($size);
public function getAvatarImage($size): ?IImage;
/**
* get the federation cloud id
@ -244,11 +229,10 @@ interface IUser {
* It is an alias to setSystemEMailAddress()
*
* @param string|null $mailAddress
* @return void
* @since 9.0.0
* @deprecated 23.0.0 use setSystemEMailAddress() or setPrimaryEMailAddress()
*/
public function setEMailAddress($mailAddress);
public function setEMailAddress($mailAddress): void;
/**
* Set the system email address of the user
@ -282,10 +266,9 @@ interface IUser {
* set for the user, the default value is returned. If a default setting
* was not set otherwise, it is return as 'none', i.e. quota is not limited.
*
* @return string
* @since 9.0.0
*/
public function getQuota();
public function getQuota(): string;
/**
* Get the users' quota in machine readable form. If a specific quota is set
@ -300,10 +283,9 @@ interface IUser {
* set the users' quota
*
* @param string $quota
* @return void
* @since 9.0.0
*/
public function setQuota($quota);
public function setQuota($quota): void;
/**
* Get the user's manager UIDs

View file

@ -98,11 +98,10 @@ interface IFactory {
public function languageExists($app, $lang);
/**
* @param string $locale
* @return bool
* @since 14.0.0
* @since 35.0.0 Use typed parameter and return
*/
public function localeExists($locale);
public function localeExists(string $locale): bool;
/**
* Return the language direction

View file

@ -72,7 +72,7 @@ class ContactsMenuControllerTest extends TestCase {
$entries[0]->method('getProperty')
->with('UID')
->willReturn('member1');
$entries[0]->method('getProperty')
$entries[1]->method('getProperty')
->with('UID')
->willReturn('member2');

Binary file not shown.

Before

Width:  |  Height:  |  Size: 270 B

After

Width:  |  Height:  |  Size: 272 B

View file

@ -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'));
}
}

View file

@ -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')

View file

@ -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);
}

View file

@ -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(

View file

@ -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');

View file

@ -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,

View file

@ -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());

View file

@ -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 {

View file

@ -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]);

View file

@ -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);

View file

@ -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__)];

View file

@ -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())

View file

@ -18,6 +18,8 @@
<directory>Core/</directory>
<directory>../apps/</directory>
<exclude>../apps/user_ldap/tests/Integration</exclude>
<!-- exclude files_external as it is tested separately -->
<exclude>../apps/files_external</exclude>
</testsuite>
<source>
<include>
@ -27,7 +29,7 @@
<directory>../3rdparty</directory>
<directory>../apps/*/composer</directory>
<directory>../apps/*/tests</directory>
<directory>../apps/files_external/3rdparty</directory>
<directory>../apps/files_external</directory>
<directory>../build</directory>
<directory>../lib/composer</directory>
<directory>../tests</directory>

View file

@ -16,6 +16,7 @@ $CONFIG = [
'writable' => true,
],
],
'tempdirectory' => '/dev/shm',
];
if (is_dir(OC::$SERVERROOT . '/apps2')) {