mirror of
https://github.com/nextcloud/server.git
synced 2026-04-01 23:25:47 -04:00
Merge pull request #29432 from nextcloud/fix/support-php-8.1
Support PHP 8.1 - First batch
This commit is contained in:
commit
fd487c1a43
72 changed files with 200 additions and 129 deletions
|
|
@ -62,7 +62,7 @@ class AnonymousOptionsPlugin extends ServerPlugin {
|
|||
* @return bool
|
||||
*/
|
||||
public function handleAnonymousOptions(RequestInterface $request, ResponseInterface $response) {
|
||||
$isOffice = preg_match('/Microsoft Office/i', $request->getHeader('User-Agent'));
|
||||
$isOffice = preg_match('/Microsoft Office/i', $request->getHeader('User-Agent') ?? '');
|
||||
$emptyAuth = $request->getHeader('Authorization') === null
|
||||
|| $request->getHeader('Authorization') === ''
|
||||
|| trim($request->getHeader('Authorization')) === 'Bearer';
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ class Auth extends AbstractBasic {
|
|||
}
|
||||
}
|
||||
|
||||
if (!$this->userSession->isLoggedIn() && in_array('XMLHttpRequest', explode(',', $request->getHeader('X-Requested-With')))) {
|
||||
if (!$this->userSession->isLoggedIn() && in_array('XMLHttpRequest', explode(',', $request->getHeader('X-Requested-With') ?? ''))) {
|
||||
// do not re-authenticate over ajax, use dummy auth name to prevent browser popup
|
||||
$response->addHeader('WWW-Authenticate','DummyBasic realm="' . $this->realm . '"');
|
||||
$response->setStatus(401);
|
||||
|
|
|
|||
|
|
@ -241,7 +241,7 @@ class FilesReportPlugin extends ServerPlugin {
|
|||
*
|
||||
* @return string files base uri
|
||||
*/
|
||||
private function getFilesBaseUri($uri, $subPath) {
|
||||
private function getFilesBaseUri(string $uri, string $subPath): string {
|
||||
$uri = trim($uri, '/');
|
||||
$subPath = trim($subPath, '/');
|
||||
if (empty($subPath)) {
|
||||
|
|
|
|||
|
|
@ -277,7 +277,7 @@ class AssemblyStream implements \Icewind\Streams\File {
|
|||
]);
|
||||
stream_wrapper_register('assembly', self::class);
|
||||
try {
|
||||
$wrapped = fopen('assembly://', 'r', null, $context);
|
||||
$wrapped = fopen('assembly://', 'r', false, $context);
|
||||
} catch (\BadMethodCallException $e) {
|
||||
stream_wrapper_unregister('assembly');
|
||||
throw $e;
|
||||
|
|
|
|||
|
|
@ -229,6 +229,9 @@ class FilesReportPluginTest extends \Test\TestCase {
|
|||
$reportTargetNode = $this->getMockBuilder(Directory::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$reportTargetNode->expects($this->any())
|
||||
->method('getPath')
|
||||
->willReturn('');
|
||||
|
||||
$response = $this->getMockBuilder(ResponseInterface::class)
|
||||
->disableOriginalConstructor()
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ class ApiControllerTest extends TestCase {
|
|||
$this->assertEquals($expected, $this->apiController->getThumbnail(0, 0, ''));
|
||||
}
|
||||
|
||||
public function testGetThumbnailInvaidImage() {
|
||||
public function testGetThumbnailInvalidImage() {
|
||||
$file = $this->createMock(File::class);
|
||||
$this->userFolder->method('get')
|
||||
->with($this->equalTo('unknown.jpg'))
|
||||
|
|
@ -184,6 +184,8 @@ class ApiControllerTest extends TestCase {
|
|||
->with($this->equalTo('known.jpg'))
|
||||
->willReturn($file);
|
||||
$preview = $this->createMock(ISimpleFile::class);
|
||||
$preview->method('getName')->willReturn('my name');
|
||||
$preview->method('getMTime')->willReturn(42);
|
||||
$this->preview->expects($this->once())
|
||||
->method('getPreview')
|
||||
->with($this->equalTo($file), 10, 10, true)
|
||||
|
|
|
|||
|
|
@ -90,10 +90,8 @@ class AuthMechanism implements \JsonSerializable {
|
|||
|
||||
/**
|
||||
* Serialize into JSON for client-side JS
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function jsonSerialize() {
|
||||
public function jsonSerialize(): array {
|
||||
$data = $this->jsonSerializeDefinition();
|
||||
$data += $this->jsonSerializeIdentifier();
|
||||
|
||||
|
|
|
|||
|
|
@ -137,10 +137,8 @@ class Backend implements \JsonSerializable {
|
|||
|
||||
/**
|
||||
* Serialize into JSON for client-side JS
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function jsonSerialize() {
|
||||
public function jsonSerialize(): array {
|
||||
$data = $this->jsonSerializeDefinition();
|
||||
$data += $this->jsonSerializeIdentifier();
|
||||
|
||||
|
|
|
|||
|
|
@ -167,10 +167,8 @@ class DefinitionParameter implements \JsonSerializable {
|
|||
|
||||
/**
|
||||
* Serialize into JSON for client-side JS
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function jsonSerialize() {
|
||||
public function jsonSerialize(): array {
|
||||
return [
|
||||
'value' => $this->getText(),
|
||||
'flags' => $this->getFlags(),
|
||||
|
|
|
|||
|
|
@ -396,10 +396,8 @@ class StorageConfig implements \JsonSerializable {
|
|||
|
||||
/**
|
||||
* Serialize config to JSON
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function jsonSerialize() {
|
||||
public function jsonSerialize(): array {
|
||||
$result = [];
|
||||
if (!is_null($this->id)) {
|
||||
$result['id'] = $this->id;
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ class JSDataService implements \JsonSerializable {
|
|||
$this->appConfig = $appConfig;
|
||||
}
|
||||
|
||||
public function jsonSerialize() {
|
||||
public function jsonSerialize(): array {
|
||||
return [
|
||||
'name' => $this->themingDefaults->getName(),
|
||||
'url' => $this->themingDefaults->getBaseUrl(),
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ class JSDataService implements \JsonSerializable {
|
|||
$this->statusService = $statusService;
|
||||
}
|
||||
|
||||
public function jsonSerialize() {
|
||||
public function jsonSerialize(): array {
|
||||
$user = $this->userSession->getUser();
|
||||
|
||||
if ($user === null) {
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ class Test extends Command {
|
|||
];
|
||||
}
|
||||
|
||||
public function jsonSerialize() {
|
||||
public function jsonSerialize(): array {
|
||||
return [
|
||||
'description' => 'this is a test event',
|
||||
];
|
||||
|
|
|
|||
|
|
@ -283,11 +283,12 @@ class AvatarController extends Controller {
|
|||
$image = new \OC_Image();
|
||||
$image->loadFromData($tmpAvatar);
|
||||
|
||||
$resp = new DataDisplayResponse($image->data(),
|
||||
$resp = new DataDisplayResponse(
|
||||
$image->data() ?? '',
|
||||
Http::STATUS_OK,
|
||||
['Content-Type' => $image->mimeType()]);
|
||||
|
||||
$resp->setETag((string)crc32($image->data()));
|
||||
$resp->setETag((string)crc32($image->data() ?? ''));
|
||||
$resp->cacheFor(0);
|
||||
$resp->setLastModified(new \DateTime('now', new \DateTimeZone('GMT')));
|
||||
return $resp;
|
||||
|
|
|
|||
|
|
@ -104,7 +104,8 @@ class Account implements IAccount {
|
|||
return $result;
|
||||
}
|
||||
|
||||
public function jsonSerialize() {
|
||||
/** @return IAccountPropertyCollection[]|IAccountProperty[] */
|
||||
public function jsonSerialize(): array {
|
||||
return $this->properties;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ class AccountProperty implements IAccountProperty {
|
|||
$this->verificationData = $verificationData;
|
||||
}
|
||||
|
||||
public function jsonSerialize() {
|
||||
public function jsonSerialize(): array {
|
||||
return [
|
||||
'name' => $this->getName(),
|
||||
'value' => $this->getValue(),
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ class AccountPropertyCollection implements IAccountPropertyCollection {
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function jsonSerialize() {
|
||||
public function jsonSerialize(): array {
|
||||
return [$this->collectionName => $this->properties];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -199,6 +199,7 @@ class Request implements \ArrayAccess, \Countable, IRequest {
|
|||
* @param string $offset
|
||||
* @return mixed
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset) {
|
||||
return isset($this->items['parameters'][$offset])
|
||||
? $this->items['parameters'][$offset]
|
||||
|
|
@ -210,7 +211,7 @@ class Request implements \ArrayAccess, \Countable, IRequest {
|
|||
* @param string $offset
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function offsetSet($offset, $value) {
|
||||
public function offsetSet($offset, $value): void {
|
||||
throw new \RuntimeException('You cannot change the contents of the request object');
|
||||
}
|
||||
|
||||
|
|
@ -218,7 +219,7 @@ class Request implements \ArrayAccess, \Countable, IRequest {
|
|||
* @see offsetExists
|
||||
* @param string $offset
|
||||
*/
|
||||
public function offsetUnset($offset) {
|
||||
public function offsetUnset($offset): void {
|
||||
throw new \RuntimeException('You cannot change the contents of the request object');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -197,13 +197,15 @@ class SimpleContainer implements ArrayAccess, ContainerInterface, IContainer {
|
|||
/**
|
||||
* @deprecated 20.0.0 use \Psr\Container\ContainerInterface::has
|
||||
*/
|
||||
public function offsetExists($id) {
|
||||
public function offsetExists($id): bool {
|
||||
return $this->container->offsetExists($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 20.0.0 use \Psr\Container\ContainerInterface::get
|
||||
* @return mixed
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($id) {
|
||||
return $this->container->offsetGet($id);
|
||||
}
|
||||
|
|
@ -211,14 +213,14 @@ class SimpleContainer implements ArrayAccess, ContainerInterface, IContainer {
|
|||
/**
|
||||
* @deprecated 20.0.0 use \OCP\IContainer::registerService
|
||||
*/
|
||||
public function offsetSet($id, $service) {
|
||||
public function offsetSet($id, $service): void {
|
||||
$this->container->offsetSet($id, $service);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 20.0.0
|
||||
*/
|
||||
public function offsetUnset($offset) {
|
||||
public function offsetUnset($offset): void {
|
||||
$this->container->offsetUnset($offset);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ class DefaultToken extends Entity implements INamedToken {
|
|||
return parent::getPassword();
|
||||
}
|
||||
|
||||
public function jsonSerialize() {
|
||||
public function jsonSerialize(): array {
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => $this->name,
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ class PublicKeyToken extends Entity implements INamedToken, IWipeableToken {
|
|||
return parent::getPassword();
|
||||
}
|
||||
|
||||
public function jsonSerialize() {
|
||||
public function jsonSerialize(): array {
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'name' => $this->name,
|
||||
|
|
|
|||
|
|
@ -63,19 +63,23 @@ class CappedMemoryCache implements ICache, \ArrayAccess {
|
|||
return true;
|
||||
}
|
||||
|
||||
public function offsetExists($offset) {
|
||||
public function offsetExists($offset): bool {
|
||||
return $this->hasKey($offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function &offsetGet($offset) {
|
||||
return $this->cache[$offset];
|
||||
}
|
||||
|
||||
public function offsetSet($offset, $value) {
|
||||
public function offsetSet($offset, $value): void {
|
||||
$this->set($offset, $value);
|
||||
}
|
||||
|
||||
public function offsetUnset($offset) {
|
||||
public function offsetUnset($offset): void {
|
||||
$this->remove($offset);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ class UserPlugin implements ISearchPlugin {
|
|||
$this->shareeEnumerationFullMatch &&
|
||||
$lowerSearch !== '' && (strtolower($uid) === $lowerSearch ||
|
||||
strtolower($userDisplayName) === $lowerSearch ||
|
||||
strtolower($userEmail) === $lowerSearch)
|
||||
strtolower($userEmail ?? '') === $lowerSearch)
|
||||
) {
|
||||
if (strtolower($uid) === $lowerSearch) {
|
||||
$foundUserById = true;
|
||||
|
|
|
|||
|
|
@ -106,10 +106,7 @@ class LinkAction implements ILinkAction {
|
|||
return $this->appId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function jsonSerialize() {
|
||||
public function jsonSerialize(): array {
|
||||
return [
|
||||
'title' => $this->name,
|
||||
'icon' => $this->icon,
|
||||
|
|
|
|||
|
|
@ -414,11 +414,11 @@ class ExpressionBuilder implements IExpressionBuilder {
|
|||
* Quotes a given input parameter.
|
||||
*
|
||||
* @param mixed $input The parameter to be quoted.
|
||||
* @param mixed|null $type One of the IQueryBuilder::PARAM_* constants
|
||||
* @param int $type One of the IQueryBuilder::PARAM_* constants
|
||||
*
|
||||
* @return ILiteral
|
||||
*/
|
||||
public function literal($input, $type = null): ILiteral {
|
||||
public function literal($input, $type = IQueryBuilder::PARAM_STR): ILiteral {
|
||||
return new Literal($this->expressionBuilder->literal($input, $type));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -100,19 +100,23 @@ class GenericEventWrapper extends GenericEvent {
|
|||
return $this->event->hasArgument($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($key) {
|
||||
return $this->event->offsetGet($key);
|
||||
}
|
||||
|
||||
public function offsetSet($key, $value) {
|
||||
return $this->event->offsetSet($key, $value);
|
||||
public function offsetSet($key, $value): void {
|
||||
$this->event->offsetSet($key, $value);
|
||||
}
|
||||
|
||||
public function offsetUnset($key) {
|
||||
return $this->event->offsetUnset($key);
|
||||
public function offsetUnset($key): void {
|
||||
$this->event->offsetUnset($key);
|
||||
}
|
||||
|
||||
public function offsetExists($key) {
|
||||
public function offsetExists($key): bool {
|
||||
return $this->event->offsetExists($key);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,18 +37,22 @@ class CacheEntry implements ICacheEntry {
|
|||
$this->data = $data;
|
||||
}
|
||||
|
||||
public function offsetSet($offset, $value) {
|
||||
public function offsetSet($offset, $value): void {
|
||||
$this->data[$offset] = $value;
|
||||
}
|
||||
|
||||
public function offsetExists($offset) {
|
||||
public function offsetExists($offset): bool {
|
||||
return isset($this->data[$offset]);
|
||||
}
|
||||
|
||||
public function offsetUnset($offset) {
|
||||
public function offsetUnset($offset): void {
|
||||
unset($this->data[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset) {
|
||||
if (isset($this->data[$offset])) {
|
||||
return $this->data[$offset];
|
||||
|
|
|
|||
|
|
@ -104,18 +104,22 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess {
|
|||
$this->rawSize = $this->data['size'] ?? 0;
|
||||
}
|
||||
|
||||
public function offsetSet($offset, $value) {
|
||||
public function offsetSet($offset, $value): void {
|
||||
$this->data[$offset] = $value;
|
||||
}
|
||||
|
||||
public function offsetExists($offset) {
|
||||
public function offsetExists($offset): bool {
|
||||
return isset($this->data[$offset]);
|
||||
}
|
||||
|
||||
public function offsetUnset($offset) {
|
||||
public function offsetUnset($offset): void {
|
||||
unset($this->data[$offset]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset) {
|
||||
if ($offset === 'type') {
|
||||
return $this->getType();
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ class S3Signature implements SignatureInterface {
|
|||
$modify['set_headers']['X-Amz-Security-Token'] = $token;
|
||||
}
|
||||
|
||||
return Psr7\modify_request($request, $modify);
|
||||
return Psr7\Utils::modifyRequest($request, $modify);
|
||||
}
|
||||
|
||||
private function signString($string, CredentialsInterface $credentials) {
|
||||
|
|
@ -201,7 +201,7 @@ class S3Signature implements SignatureInterface {
|
|||
$query = $request->getUri()->getQuery();
|
||||
|
||||
if ($query) {
|
||||
$params = Psr7\parse_query($query);
|
||||
$params = Psr7\Query::parse($query);
|
||||
$first = true;
|
||||
foreach ($this->signableQueryString as $key) {
|
||||
if (array_key_exists($key, $params)) {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ namespace OC\Files\ObjectStore;
|
|||
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Exception\BadResponseException;
|
||||
use function GuzzleHttp\Psr7\stream_for;
|
||||
use GuzzleHttp\Psr7\Utils;
|
||||
use Icewind\Streams\RetryWrapper;
|
||||
use OCP\Files\NotFoundException;
|
||||
use OCP\Files\ObjectStore\IObjectStore;
|
||||
|
|
@ -81,13 +81,13 @@ class Swift implements IObjectStore {
|
|||
if (filesize($tmpFile) < SWIFT_SEGMENT_SIZE) {
|
||||
$this->getContainer()->createObject([
|
||||
'name' => $urn,
|
||||
'stream' => stream_for($handle),
|
||||
'stream' => Utils::streamFor($handle),
|
||||
'contentType' => $mimetype,
|
||||
]);
|
||||
} else {
|
||||
$this->getContainer()->createLargeObject([
|
||||
'name' => $urn,
|
||||
'stream' => stream_for($handle),
|
||||
'stream' => Utils::streamFor($handle),
|
||||
'segmentSize' => SWIFT_SEGMENT_SIZE,
|
||||
'contentType' => $mimetype,
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -963,10 +963,8 @@ class IndexDocument implements IIndexDocument, JsonSerializable {
|
|||
|
||||
/**
|
||||
* @since 15.0.0
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function jsonSerialize() {
|
||||
public function jsonSerialize(): array {
|
||||
return [
|
||||
'id' => $this->getId(),
|
||||
'providerId' => $this->getProviderId(),
|
||||
|
|
|
|||
|
|
@ -168,10 +168,9 @@ final class SearchRequestSimpleQuery implements ISearchRequestSimpleQuery, JsonS
|
|||
|
||||
|
||||
/**
|
||||
* @return array|mixed
|
||||
* @since 17.0.0
|
||||
*/
|
||||
public function jsonSerialize() {
|
||||
public function jsonSerialize(): array {
|
||||
return [
|
||||
'type' => $this->getType(),
|
||||
'field' => $this->getField(),
|
||||
|
|
|
|||
|
|
@ -59,10 +59,7 @@ class ExcludeFileByNameFilterIterator extends \RecursiveFilterIterator {
|
|||
'/^\.webapp-nextcloud-(\d+\.){2}(\d+)(-r\d+)?$/', // Gentoo/Funtoo & derivatives use a tool known as webapp-config to manage wep-apps.
|
||||
];
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function accept() {
|
||||
public function accept(): bool {
|
||||
/** @var \SplFileInfo $current */
|
||||
$current = $this->current();
|
||||
|
||||
|
|
|
|||
|
|
@ -59,10 +59,7 @@ class ExcludeFoldersByPathFilterIterator extends \RecursiveFilterIterator {
|
|||
$this->excludedFolders = array_merge($excludedFolders, $appFolders);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function accept() {
|
||||
public function accept(): bool {
|
||||
return !\in_array(
|
||||
$this->current()->getPathName(),
|
||||
$this->excludedFolders,
|
||||
|
|
|
|||
|
|
@ -82,11 +82,7 @@ class L10NString implements \JsonSerializable {
|
|||
return vsprintf($text, $this->parameters);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function jsonSerialize() {
|
||||
public function jsonSerialize(): string {
|
||||
return $this->__toString();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class LanguageIterator implements ILanguageIterator {
|
|||
/**
|
||||
* Rewind the Iterator to the first element
|
||||
*/
|
||||
public function rewind() {
|
||||
public function rewind(): void {
|
||||
$this->i = 0;
|
||||
}
|
||||
|
||||
|
|
@ -112,7 +112,7 @@ class LanguageIterator implements ILanguageIterator {
|
|||
*
|
||||
* @since 14.0.0
|
||||
*/
|
||||
public function next() {
|
||||
public function next(): void {
|
||||
++$this->i;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ abstract class LogDetails {
|
|||
}
|
||||
$time = \DateTime::createFromFormat("U.u", number_format(microtime(true), 4, ".", ""));
|
||||
if ($time === false) {
|
||||
$time = new \DateTime(null, $timezone);
|
||||
$time = new \DateTime('now', $timezone);
|
||||
} else {
|
||||
// apply timezone if $time is created from UNIX timestamp
|
||||
$time->setTimezone($timezone);
|
||||
|
|
|
|||
|
|
@ -78,19 +78,23 @@ abstract class Cache implements \ArrayAccess, \OCP\ICache {
|
|||
|
||||
//implement the ArrayAccess interface
|
||||
|
||||
public function offsetExists($offset) {
|
||||
public function offsetExists($offset): bool {
|
||||
return $this->hasKey($offset);
|
||||
}
|
||||
|
||||
public function offsetSet($offset, $value) {
|
||||
public function offsetSet($offset, $value): void {
|
||||
$this->set($offset, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset) {
|
||||
return $this->get($offset);
|
||||
}
|
||||
|
||||
public function offsetUnset($offset) {
|
||||
public function offsetUnset($offset): void {
|
||||
$this->remove($offset);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -195,6 +195,7 @@ class CryptoSessionData implements \ArrayAccess, ISession {
|
|||
* @param mixed $offset
|
||||
* @return mixed
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset) {
|
||||
return $this->get($offset);
|
||||
}
|
||||
|
|
@ -203,14 +204,14 @@ class CryptoSessionData implements \ArrayAccess, ISession {
|
|||
* @param mixed $offset
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function offsetSet($offset, $value) {
|
||||
public function offsetSet($offset, $value): void {
|
||||
$this->set($offset, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $offset
|
||||
*/
|
||||
public function offsetUnset($offset) {
|
||||
public function offsetUnset($offset): void {
|
||||
$this->remove($offset);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ abstract class Session implements \ArrayAccess, ISession {
|
|||
* @param mixed $offset
|
||||
* @return mixed
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset) {
|
||||
return $this->get($offset);
|
||||
}
|
||||
|
|
@ -63,14 +64,14 @@ abstract class Session implements \ArrayAccess, ISession {
|
|||
* @param mixed $offset
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function offsetSet($offset, $value) {
|
||||
public function offsetSet($offset, $value): void {
|
||||
$this->set($offset, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $offset
|
||||
*/
|
||||
public function offsetUnset($offset) {
|
||||
public function offsetUnset($offset): void {
|
||||
$this->remove($offset);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -480,7 +480,7 @@ class Setup {
|
|||
if (!filter_var($webRoot, FILTER_VALIDATE_URL)) {
|
||||
throw new InvalidArgumentException('invalid value for overwrite.cli.url');
|
||||
}
|
||||
$webRoot = rtrim(parse_url($webRoot, PHP_URL_PATH), '/');
|
||||
$webRoot = rtrim((parse_url($webRoot, PHP_URL_PATH) ?? ''), '/');
|
||||
} else {
|
||||
$webRoot = !empty(\OC::$WEBROOT) ? \OC::$WEBROOT : '/';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1363,7 +1363,7 @@ class DefaultShareProvider implements IShareProvider {
|
|||
$best = [];
|
||||
$bestDepth = 0;
|
||||
foreach ($shares as $id => $share) {
|
||||
$depth = substr_count($share['file_target'], '/');
|
||||
$depth = substr_count(($share['file_target'] ?? ''), '/');
|
||||
if (empty($best) || $depth < $bestDepth) {
|
||||
$bestDepth = $depth;
|
||||
$best = [
|
||||
|
|
|
|||
|
|
@ -386,13 +386,14 @@ class Database extends ABackend implements
|
|||
$row = $result->fetch();
|
||||
$result->closeCursor();
|
||||
|
||||
$this->cache[$uid] = false;
|
||||
|
||||
// "uid" is primary key, so there can only be a single result
|
||||
if ($row !== false) {
|
||||
$this->cache[$uid]['uid'] = (string)$row['uid'];
|
||||
$this->cache[$uid]['displayname'] = (string)$row['displayname'];
|
||||
$this->cache[$uid] = [
|
||||
'uid' => (string)$row['uid'],
|
||||
'displayname' => (string)$row['displayname'],
|
||||
];
|
||||
} else {
|
||||
$this->cache[$uid] = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,7 +42,9 @@ abstract class InitialStateProvider implements \JsonSerializable {
|
|||
|
||||
/**
|
||||
* @since 21.0.0
|
||||
* @return mixed
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
final public function jsonSerialize() {
|
||||
return $this->getData();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -418,7 +418,7 @@ interface IExpressionBuilder {
|
|||
* Quotes a given input parameter.
|
||||
*
|
||||
* @param mixed $input The parameter to be quoted.
|
||||
* @param mixed|null $type One of the IQueryBuilder::PARAM_* constants
|
||||
* @param int $type One of the IQueryBuilder::PARAM_* constants
|
||||
*
|
||||
* @return ILiteral
|
||||
* @since 8.2.0
|
||||
|
|
@ -426,7 +426,7 @@ interface IExpressionBuilder {
|
|||
* @psalm-taint-sink sql $input
|
||||
* @psalm-taint-sink sql $type
|
||||
*/
|
||||
public function literal($input, $type = null): ILiteral;
|
||||
public function literal($input, $type = IQueryBuilder::PARAM_STR): ILiteral;
|
||||
|
||||
/**
|
||||
* Returns a IQueryFunction that casts the column to the given type
|
||||
|
|
|
|||
|
|
@ -230,10 +230,8 @@ final class WidgetSetting implements JsonSerializable {
|
|||
/**
|
||||
* @since 15.0.0
|
||||
* @deprecated 20.0.0
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function jsonSerialize() {
|
||||
public function jsonSerialize(): array {
|
||||
return [
|
||||
'name' => $this->getName(),
|
||||
'title' => $this->getTitle(),
|
||||
|
|
|
|||
|
|
@ -261,10 +261,8 @@ final class WidgetSetup implements JsonSerializable {
|
|||
/**
|
||||
* @since 15.0.0
|
||||
* @deprecated 20.0.0
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function jsonSerialize() {
|
||||
public function jsonSerialize(): array {
|
||||
return [
|
||||
'size' => $this->getSizes(),
|
||||
'menu' => $this->getMenuEntries(),
|
||||
|
|
|
|||
|
|
@ -312,10 +312,8 @@ final class WidgetTemplate implements JsonSerializable {
|
|||
/**
|
||||
* @since 15.0.0
|
||||
* @deprecated 20.0.0
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function jsonSerialize() {
|
||||
public function jsonSerialize(): array {
|
||||
return [
|
||||
'icon' => $this->getIcon(),
|
||||
'css' => $this->getCss(),
|
||||
|
|
|
|||
|
|
@ -57,9 +57,8 @@ abstract class ATemplate implements JsonSerializable {
|
|||
|
||||
/**
|
||||
* @since 18.0.0
|
||||
* @return array|mixed
|
||||
*/
|
||||
public function jsonSerialize() {
|
||||
public function jsonSerialize(): array {
|
||||
return [
|
||||
'id' => $this->getId(),
|
||||
'title' => $this->getTitle(),
|
||||
|
|
|
|||
|
|
@ -156,7 +156,9 @@ class GenericEvent extends Event implements ArrayAccess, IteratorAggregate {
|
|||
* @link https://php.net/manual/en/arrayaccess.offsetget.php
|
||||
* @since 18.0.0
|
||||
* @deprecated 22.0.0
|
||||
* @return mixed
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset) {
|
||||
return $this->arguments[$offset];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ final class Template implements \JsonSerializable {
|
|||
/**
|
||||
* @since 21.0.0
|
||||
*/
|
||||
public function jsonSerialize() {
|
||||
public function jsonSerialize(): array {
|
||||
return [
|
||||
'templateType' => $this->templateType,
|
||||
'templateId' => $this->templateId,
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ final class TemplateFileCreator implements \JsonSerializable {
|
|||
/**
|
||||
* @since 21.0.0
|
||||
*/
|
||||
public function jsonSerialize() {
|
||||
public function jsonSerialize(): array {
|
||||
return [
|
||||
'app' => $this->appId,
|
||||
'label' => $this->actionName,
|
||||
|
|
|
|||
|
|
@ -53,7 +53,9 @@ interface ILanguageIterator extends \Iterator {
|
|||
* Move forward to next element
|
||||
*
|
||||
* @since 14.0.0
|
||||
* @return void
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function next();
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -74,9 +74,12 @@ class ChangeKeyStorageRootTest extends TestCase {
|
|||
$this->outputInterface = $this->getMockBuilder(OutputInterface::class)->getMock();
|
||||
$this->userInterface = $this->getMockBuilder(UserInterface::class)->getMock();
|
||||
|
||||
$outputFormatterInterface = $this->getMockBuilder(OutputFormatterInterface::class)->getMock();
|
||||
/* We need format method to return a string */
|
||||
$outputFormatter = $this->createMock(OutputFormatterInterface::class);
|
||||
$outputFormatter->method('format')->willReturnArgument(0);
|
||||
|
||||
$this->outputInterface->expects($this->any())->method('getFormatter')
|
||||
->willReturn($outputFormatterInterface);
|
||||
->willReturn($outputFormatter);
|
||||
|
||||
$this->changeKeyStorageRoot = new ChangeKeyStorageRoot(
|
||||
$this->view,
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ class FileTest extends TestCase {
|
|||
}
|
||||
|
||||
public function testEnable() {
|
||||
$this->config->method('getSystemValue')->willReturnArgument(1);
|
||||
$this->consoleInput->method('getOption')
|
||||
->willReturnMap([
|
||||
['enable', 'true']
|
||||
|
|
@ -63,6 +64,7 @@ class FileTest extends TestCase {
|
|||
}
|
||||
|
||||
public function testChangeFile() {
|
||||
$this->config->method('getSystemValue')->willReturnArgument(1);
|
||||
$this->consoleInput->method('getOption')
|
||||
->willReturnMap([
|
||||
['file', '/foo/bar/file.log']
|
||||
|
|
@ -87,6 +89,7 @@ class FileTest extends TestCase {
|
|||
* @dataProvider changeRotateSizeProvider
|
||||
*/
|
||||
public function testChangeRotateSize($optionValue, $configValue) {
|
||||
$this->config->method('getSystemValue')->willReturnArgument(1);
|
||||
$this->consoleInput->method('getOption')
|
||||
->willReturnMap([
|
||||
['rotate-size', $optionValue]
|
||||
|
|
|
|||
|
|
@ -68,9 +68,14 @@ class RepairTest extends TestCase {
|
|||
$this->output->expects($this->any())
|
||||
->method('section')
|
||||
->willReturn($this->output);
|
||||
|
||||
/* We need format method to return a string */
|
||||
$outputFormatter = $this->createMock(OutputFormatterInterface::class);
|
||||
$outputFormatter->method('format')->willReturnArgument(0);
|
||||
|
||||
$this->output->expects($this->any())
|
||||
->method('getFormatter')
|
||||
->willReturn($this->getMockBuilder(OutputFormatterInterface::class)->getMock());
|
||||
->willReturn($outputFormatter);
|
||||
$this->output->expects($this->any())
|
||||
->method('writeln')
|
||||
->willReturnCallback(function ($line) use ($self) {
|
||||
|
|
|
|||
|
|
@ -119,6 +119,8 @@ class AvatarControllerTest extends \Test\TestCase {
|
|||
$this->avatarFile->method('getContent')->willReturn('image data');
|
||||
$this->avatarFile->method('getMimeType')->willReturn('image type');
|
||||
$this->avatarFile->method('getEtag')->willReturn('my etag');
|
||||
$this->avatarFile->method('getName')->willReturn('my name');
|
||||
$this->avatarFile->method('getMTime')->willReturn(42);
|
||||
}
|
||||
|
||||
protected function tearDown(): void {
|
||||
|
|
@ -290,7 +292,7 @@ class AvatarControllerTest extends \Test\TestCase {
|
|||
*/
|
||||
public function testPostAvatarFile() {
|
||||
//Create temp file
|
||||
$fileName = tempnam(null, "avatarTest");
|
||||
$fileName = tempnam('', "avatarTest");
|
||||
$copyRes = copy(\OC::$SERVERROOT.'/tests/data/testimage.jpg', $fileName);
|
||||
$this->assertTrue($copyRes);
|
||||
|
||||
|
|
@ -328,7 +330,7 @@ class AvatarControllerTest extends \Test\TestCase {
|
|||
*/
|
||||
public function testPostAvatarFileGif() {
|
||||
//Create temp file
|
||||
$fileName = tempnam(null, "avatarTest");
|
||||
$fileName = tempnam('', "avatarTest");
|
||||
$copyRes = copy(\OC::$SERVERROOT.'/tests/data/testimage.gif', $fileName);
|
||||
$this->assertTrue($copyRes);
|
||||
|
||||
|
|
|
|||
|
|
@ -102,6 +102,8 @@ class CssControllerTest extends TestCase {
|
|||
public function testGetFile() {
|
||||
$folder = $this->createMock(ISimpleFolder::class);
|
||||
$file = $this->createMock(ISimpleFile::class);
|
||||
$file->method('getName')->willReturn('my name');
|
||||
$file->method('getMTime')->willReturn(42);
|
||||
$this->appData->method('getFolder')
|
||||
->with('myapp')
|
||||
->willReturn($folder);
|
||||
|
|
@ -125,6 +127,8 @@ class CssControllerTest extends TestCase {
|
|||
public function testGetGzipFile() {
|
||||
$folder = $this->createMock(ISimpleFolder::class);
|
||||
$gzipFile = $this->createMock(ISimpleFile::class);
|
||||
$gzipFile->method('getName')->willReturn('my name');
|
||||
$gzipFile->method('getMTime')->willReturn(42);
|
||||
$this->appData->method('getFolder')
|
||||
->with('myapp')
|
||||
->willReturn($folder);
|
||||
|
|
@ -153,6 +157,8 @@ class CssControllerTest extends TestCase {
|
|||
public function testGetGzipFileNotFound() {
|
||||
$folder = $this->createMock(ISimpleFolder::class);
|
||||
$file = $this->createMock(ISimpleFile::class);
|
||||
$file->method('getName')->willReturn('my name');
|
||||
$file->method('getMTime')->willReturn(42);
|
||||
$this->appData->method('getFolder')
|
||||
->with('myapp')
|
||||
->willReturn($folder);
|
||||
|
|
|
|||
|
|
@ -56,6 +56,8 @@ class GuestAvatarControllerTest extends \Test\TestCase {
|
|||
$this->avatar = $this->getMockBuilder(IAvatar::class)->getMock();
|
||||
$this->avatarManager = $this->getMockBuilder(IAvatarManager::class)->getMock();
|
||||
$this->file = $this->getMockBuilder(ISimpleFile::class)->getMock();
|
||||
$this->file->method('getName')->willReturn('my name');
|
||||
$this->file->method('getMTime')->willReturn(42);
|
||||
$this->guestAvatarController = new GuestAvatarController(
|
||||
'core',
|
||||
$this->request,
|
||||
|
|
|
|||
|
|
@ -102,6 +102,8 @@ class JsControllerTest extends TestCase {
|
|||
public function testGetFile() {
|
||||
$folder = $this->createMock(ISimpleFolder::class);
|
||||
$file = $this->createMock(ISimpleFile::class);
|
||||
$file->method('getName')->willReturn('my name');
|
||||
$file->method('getMTime')->willReturn(42);
|
||||
$this->appData->method('getFolder')
|
||||
->with('myapp')
|
||||
->willReturn($folder);
|
||||
|
|
@ -125,6 +127,8 @@ class JsControllerTest extends TestCase {
|
|||
public function testGetGzipFile() {
|
||||
$folder = $this->createMock(ISimpleFolder::class);
|
||||
$gzipFile = $this->createMock(ISimpleFile::class);
|
||||
$gzipFile->method('getName')->willReturn('my name');
|
||||
$gzipFile->method('getMTime')->willReturn(42);
|
||||
$this->appData->method('getFolder')
|
||||
->with('myapp')
|
||||
->willReturn($folder);
|
||||
|
|
@ -153,6 +157,8 @@ class JsControllerTest extends TestCase {
|
|||
public function testGetGzipFileNotFound() {
|
||||
$folder = $this->createMock(ISimpleFolder::class);
|
||||
$file = $this->createMock(ISimpleFile::class);
|
||||
$file->method('getName')->willReturn('my name');
|
||||
$file->method('getMTime')->willReturn(42);
|
||||
$this->appData->method('getFolder')
|
||||
->with('myapp')
|
||||
->willReturn($folder);
|
||||
|
|
|
|||
|
|
@ -212,6 +212,8 @@ class PreviewControllerTest extends \Test\TestCase {
|
|||
->willReturn(true);
|
||||
|
||||
$preview = $this->createMock(ISimpleFile::class);
|
||||
$preview->method('getName')->willReturn('my name');
|
||||
$preview->method('getMTime')->willReturn(42);
|
||||
$this->previewManager->method('getPreview')
|
||||
->with($this->equalTo($file), 10, 10, false, $this->equalTo('myMode'))
|
||||
->willReturn($preview);
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ class DispatcherTest extends \Test\TestCase {
|
|||
|
||||
$this->response = $this->createMock(Response::class);
|
||||
|
||||
$this->lastModified = new \DateTime(null, new \DateTimeZone('GMT'));
|
||||
$this->lastModified = new \DateTime('now', new \DateTimeZone('GMT'));
|
||||
$this->etag = 'hi';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ class ResponseTest extends \Test\TestCase {
|
|||
|
||||
|
||||
public function testGetLastModified() {
|
||||
$lastModified = new \DateTime(null, new \DateTimeZone('GMT'));
|
||||
$lastModified = new \DateTime('now', new \DateTimeZone('GMT'));
|
||||
$lastModified->setTimestamp(1);
|
||||
$this->childResponse->setLastModified($lastModified);
|
||||
$this->assertEquals($lastModified, $this->childResponse->getLastModified());
|
||||
|
|
@ -252,7 +252,7 @@ class ResponseTest extends \Test\TestCase {
|
|||
|
||||
|
||||
public function testEtagLastModifiedHeaders() {
|
||||
$lastModified = new \DateTime(null, new \DateTimeZone('GMT'));
|
||||
$lastModified = new \DateTime('now', new \DateTimeZone('GMT'));
|
||||
$lastModified->setTimestamp(1);
|
||||
$this->childResponse->setLastModified($lastModified);
|
||||
$headers = $this->childResponse->getHeaders();
|
||||
|
|
@ -260,7 +260,7 @@ class ResponseTest extends \Test\TestCase {
|
|||
}
|
||||
|
||||
public function testChainability() {
|
||||
$lastModified = new \DateTime(null, new \DateTimeZone('GMT'));
|
||||
$lastModified = new \DateTime('now', new \DateTimeZone('GMT'));
|
||||
$lastModified->setTimestamp(1);
|
||||
|
||||
$this->childResponse->setEtag('hi')
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ use PHPUnit\Framework\MockObject\MockObject;
|
|||
use Psr\Log\LoggerInterface;
|
||||
use Test\TestCase;
|
||||
|
||||
class RemoteWipeActivityListenerTests extends TestCase {
|
||||
class RemoteWipeActivityListenerTest extends TestCase {
|
||||
|
||||
/** @var IActivityManager|MockObject */
|
||||
private $activityManager;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ use OCP\Notification\INotification;
|
|||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Test\TestCase;
|
||||
|
||||
class RemoteWipeNotificationListenerTests extends TestCase {
|
||||
class RemoteWipeNotificationsListenerTest extends TestCase {
|
||||
|
||||
/** @var INotificationManager|MockObject */
|
||||
private $notificationManager;
|
||||
|
|
|
|||
|
|
@ -81,8 +81,12 @@ class DecryptAllTest extends TestCase {
|
|||
$this->userInterface = $this->getMockBuilder(UserInterface::class)
|
||||
->disableOriginalConstructor()->getMock();
|
||||
|
||||
/* We need format method to return a string */
|
||||
$outputFormatter = $this->createMock(OutputFormatterInterface::class);
|
||||
$outputFormatter->method('format')->willReturn('foo');
|
||||
|
||||
$this->outputInterface->expects($this->any())->method('getFormatter')
|
||||
->willReturn($this->createMock(OutputFormatterInterface::class));
|
||||
->willReturn($outputFormatter);
|
||||
|
||||
$this->instance = new DecryptAll($this->encryptionManager, $this->userManager, $this->view);
|
||||
|
||||
|
|
@ -298,10 +302,15 @@ class DecryptAllTest extends TestCase {
|
|||
->method('decryptFile')
|
||||
->with('/user1/files/foo/subfile');
|
||||
|
||||
|
||||
/* We need format method to return a string */
|
||||
$outputFormatter = $this->createMock(OutputFormatterInterface::class);
|
||||
$outputFormatter->method('format')->willReturn('foo');
|
||||
|
||||
$output = $this->createMock(OutputInterface::class);
|
||||
$output->expects($this->any())
|
||||
->method('getFormatter')
|
||||
->willReturn($this->createMock(OutputFormatterInterface::class));
|
||||
->willReturn($outputFormatter);
|
||||
$progressBar = new ProgressBar($output);
|
||||
|
||||
$this->invokePrivate($instance, 'decryptUsersFiles', ['user1', $progressBar, '']);
|
||||
|
|
|
|||
|
|
@ -47,7 +47,18 @@ class UserMountCacheTest extends TestCase {
|
|||
protected function setUp(): void {
|
||||
$this->fileIds = [];
|
||||
$this->connection = \OC::$server->getDatabaseConnection();
|
||||
$this->userManager = new Manager($this->createMock(IConfig::class), $this->createMock(EventDispatcherInterface::class), $this->createMock(ICacheFactory::class), $this->createMock(IEventDispatcher::class));
|
||||
$config = $this->getMockBuilder(IConfig::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$config
|
||||
->expects($this->any())
|
||||
->method('getUserValue')
|
||||
->willReturnArgument(3);
|
||||
$config
|
||||
->expects($this->any())
|
||||
->method('getAppValue')
|
||||
->willReturnArgument(2);
|
||||
$this->userManager = new Manager($config, $this->createMock(EventDispatcherInterface::class), $this->createMock(ICacheFactory::class), $this->createMock(IEventDispatcher::class));
|
||||
$userBackend = new Dummy();
|
||||
$userBackend->createUser('u1', '');
|
||||
$userBackend->createUser('u2', '');
|
||||
|
|
|
|||
|
|
@ -418,7 +418,7 @@ class FolderTest extends NodeTest {
|
|||
$subStorage = $this->createMock(Storage::class);
|
||||
$subStorage->method('getId')->willReturn('test::2');
|
||||
$subCache = new Cache($subStorage);
|
||||
$subMount = $this->getMockBuilder(MountPoint::class)->setConstructorArgs([null, ''])->getMock();
|
||||
$subMount = $this->getMockBuilder(MountPoint::class)->setConstructorArgs([Temporary::class, ''])->getMock();
|
||||
|
||||
$mount = $this->createMock(IMountPoint::class);
|
||||
$mount->method('getStorage')
|
||||
|
|
@ -954,11 +954,11 @@ class FolderTest extends NodeTest {
|
|||
$subStorage1 = $this->createMock(Storage::class);
|
||||
$subStorage1->method('getId')->willReturn('test::2');
|
||||
$subCache1 = new Cache($subStorage1);
|
||||
$subMount1 = $this->getMockBuilder(MountPoint::class)->setConstructorArgs([null, ''])->getMock();
|
||||
$subMount1 = $this->getMockBuilder(MountPoint::class)->setConstructorArgs([Temporary::class, ''])->getMock();
|
||||
$subStorage2 = $this->createMock(Storage::class);
|
||||
$subStorage2->method('getId')->willReturn('test::3');
|
||||
$subCache2 = new Cache($subStorage2);
|
||||
$subMount2 = $this->getMockBuilder(MountPoint::class)->setConstructorArgs([null, ''])->getMock();
|
||||
$subMount2 = $this->getMockBuilder(MountPoint::class)->setConstructorArgs([Temporary::class, ''])->getMock();
|
||||
|
||||
$mount = $this->createMock(IMountPoint::class);
|
||||
$mount->method('getStorage')
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
namespace Test\Http\Client;
|
||||
|
||||
use GuzzleHttp\Psr7\Response as GuzzleResponse;
|
||||
use function GuzzleHttp\Psr7\stream_for;
|
||||
use GuzzleHttp\Psr7\Utils;
|
||||
use OC\Http\Client\Response;
|
||||
|
||||
/**
|
||||
|
|
@ -25,7 +25,7 @@ class ResponseTest extends \Test\TestCase {
|
|||
}
|
||||
|
||||
public function testGetBody() {
|
||||
$response = new Response($this->guzzleResponse->withBody(stream_for('MyResponse')));
|
||||
$response = new Response($this->guzzleResponse->withBody(Utils::streamFor('MyResponse')));
|
||||
$this->assertSame('MyResponse', $response->getBody());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ class InitialStateServiceTest extends TestCase {
|
|||
[23],
|
||||
[2.3],
|
||||
[new class implements JsonSerializable {
|
||||
public function jsonSerialize() {
|
||||
public function jsonSerialize(): int {
|
||||
return 3;
|
||||
}
|
||||
}],
|
||||
|
|
|
|||
|
|
@ -26,7 +26,9 @@ class TempManagerTest extends \Test\TestCase {
|
|||
}
|
||||
|
||||
protected function tearDown(): void {
|
||||
\OC_Helper::rmdirr($this->baseDir);
|
||||
if ($this->baseDir !== null) {
|
||||
\OC_Helper::rmdirr($this->baseDir);
|
||||
}
|
||||
$this->baseDir = null;
|
||||
parent::tearDown();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -667,7 +667,19 @@ class ManagerTest extends TestCase {
|
|||
}
|
||||
|
||||
public function testDeleteUser() {
|
||||
$manager = new \OC\User\Manager($this->config, $this->oldDispatcher, $this->cacheFactory, $this->eventDispatcher);
|
||||
$config = $this->getMockBuilder(AllConfig::class)
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$config
|
||||
->expects($this->any())
|
||||
->method('getUserValue')
|
||||
->willReturnArgument(3);
|
||||
$config
|
||||
->expects($this->any())
|
||||
->method('getAppValue')
|
||||
->willReturnArgument(2);
|
||||
|
||||
$manager = new \OC\User\Manager($config, $this->oldDispatcher, $this->cacheFactory, $this->eventDispatcher);
|
||||
$backend = new \Test\Util\User\Dummy();
|
||||
|
||||
$manager->registerBackend($backend);
|
||||
|
|
|
|||
Loading…
Reference in a new issue