Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
Christoph Wurst 2022-03-17 10:39:25 +01:00
Родитель 28d61094d8
Коммит 91610d4224
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: CC42AC2A7F0E56D8
26 изменённых файлов: 108 добавлений и 56 удалений

4
.github/workflows/lint.yml поставляемый
Просмотреть файл

@ -19,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: [7.4, 8.0]
php-versions: ['7.4', '8.0', '8.1']
name: php${{ matrix.php-versions }} lint
steps:
- name: Checkout
@ -41,7 +41,7 @@ jobs:
- name: Set up php
uses: shivammathur/setup-php@master
with:
php-version: 7.4
php-version: '8.0'
coverage: none
- name: Install dependencies
run: composer i

41
.github/workflows/test.yml поставляемый
Просмотреть файл

@ -12,16 +12,12 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: [7.4]
php-versions: ['8.0']
nextcloud-versions: ['stable22', 'stable23']
include:
- php-versions: 7.4
nextcloud-versions: stable24
- php-versions: 8.0
nextcloud-versions: stable24
- php-versions: 7.4
nextcloud-versions: master
- php-versions: 8.0
- php-versions: 8.1
nextcloud-versions: master
name: Nextcloud ${{ matrix.nextcloud-versions }} php${{ matrix.php-versions }} unit tests
steps:
@ -49,11 +45,18 @@ jobs:
- name: Run tests
working-directory: nextcloud/apps/mail
run: composer run test:unit
if: ${{ matrix.php-versions == '8.0' }}
env:
XDEBUG_MODE: coverage
- name: Run tests
working-directory: nextcloud/apps/mail
run: composer run test:unit
if: ${{ matrix.php-versions != '8.0' }}
env:
XDEBUG_MODE: off
- name: Report coverage
uses: codecov/codecov-action@v3.1.0
if: ${{ always() && matrix.nextcloud-versions == 'master' }}
if: ${{ always() && matrix.php-versions == '8.0' }}
with:
file: ./nextcloud/apps/mail/tests/clover.unit.xml
flags: unittests
@ -63,9 +66,19 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: [7.4, 8.0]
php-versions: ['8.0']
nextcloud-versions: ['master']
db: ['sqlite', 'mysql', 'pgsql']
include:
- php-versions: 7.4
nextcloud-versions: stable22
db: 'mysql'
- php-versions: 8.0
nextcloud-versions: stable23
db: 'mysql'
- php-versions: 8.1
nextcloud-versions: stable24
db: 'pgsql'
name: php${{ matrix.php-versions }}-${{ matrix.db }} integration tests
services:
mail-service:
@ -138,12 +151,16 @@ jobs:
echo "SET GLOBAL log_output = 'table';" | mysql -h 127.0.0.1 -u root -pmy-secret-pw
- name: Run tests
working-directory: nextcloud/apps/mail
run: |
ss -tunlp
true | openssl s_client -crlf -connect 127.0.0.1:993
composer run test:integration
if: ${{ matrix.db == 'mysql' }}
run: composer run test:integration
env:
XDEBUG_MODE: coverage
- name: Run tests
working-directory: nextcloud/apps/mail
if: ${{ matrix.db != 'mysql' }}
run: composer run test:integration
env:
XDEBUG_MODE: off
- name: Read slow queries
if: ${{ always() }}
run: echo "SELECT * FROM mysql.slow_log WHERE sql_text LIKE '%oc_mail%' AND sql_text NOT LIKE '%information_schema%'" | mysql -h 127.0.0.1 -u root -pmy-secret-pw

Просмотреть файл

@ -29,7 +29,7 @@
<repository type="git">https://github.com/nextcloud/mail.git</repository>
<screenshot>https://user-images.githubusercontent.com/1374172/79554966-278e1600-809f-11ea-82ea-7a0d72a2704f.png</screenshot>
<dependencies>
<php min-version="7.4" max-version="8.0" />
<php min-version="7.4" max-version="8.1" />
<nextcloud min-version="22" max-version="25" />
</dependencies>
<background-jobs>

Просмотреть файл

@ -16,7 +16,7 @@
}
},
"require": {
"php": ">=7.4",
"php": ">=7.4 <=8.1",
"arthurhoaro/favicon": "^1.2",
"bamarni/composer-bin-plugin": "^1.4",
"bytestream/horde-exception": "^2.1",

12
composer.lock сгенерированный
Просмотреть файл

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "b1c307444d66ee5ad260eb0d712b61dc",
"content-hash": "bf60d7f2e2448119556c1841143408d3",
"packages": [
{
"name": "amphp/amp",
@ -367,12 +367,12 @@
},
"type": "library",
"autoload": {
"files": [
"src/functions.php"
],
"psr-4": {
"Amp\\Serialization\\": "src"
}
},
"files": [
"src/functions.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@ -3101,7 +3101,7 @@
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": ">=7.4"
"php": ">=7.4 <=8.1"
},
"platform-dev": [],
"platform-overrides": {

Просмотреть файл

@ -50,6 +50,7 @@ use OCA\Mail\Model\Message;
use OCP\ICacheFactory;
use OCP\IConfig;
use OCP\Security\ICrypto;
use ReturnTypeWillChange;
class Account implements JsonSerializable {
@ -189,9 +190,7 @@ class Account implements JsonSerializable {
);
}
/**
* @return array
*/
#[ReturnTypeWillChange]
public function jsonSerialize() {
return $this->account->toJson();
}

Просмотреть файл

@ -28,6 +28,7 @@ namespace OCA\Mail;
use Horde_Mail_Rfc822_Address;
use JsonSerializable;
use ReturnTypeWillChange;
/**
* @psalm-immutable
@ -99,10 +100,8 @@ class Address implements JsonSerializable {
return $this->wrapped;
}
/**
* @return array
*/
public function jsonSerialize(): array {
#[ReturnTypeWillChange]
public function jsonSerialize() {
return [
'label' => $this->getLabel(),
'email' => $this->getEmail(),

Просмотреть файл

@ -31,6 +31,7 @@ use Horde_Mail_Rfc822_Address;
use Horde_Mail_Rfc822_List;
use Horde_Mail_Rfc822_Object;
use JsonSerializable;
use ReturnTypeWillChange;
/**
* @psalm-immutable
@ -95,9 +96,7 @@ class AddressList implements Countable, JsonSerializable {
return $this->addresses[0];
}
/**
* @return array
*/
#[ReturnTypeWillChange]
public function jsonSerialize() {
return array_map(function (Address $address) {
return $address->jsonSerialize();

Просмотреть файл

@ -25,6 +25,7 @@ namespace OCA\Mail\Db;
use JsonSerializable;
use OCP\AppFramework\Db\Entity;
use ReturnTypeWillChange;
/**
* @method void setAccountId(int $accountId)
@ -66,7 +67,8 @@ class Alias extends Entity implements JsonSerializable {
return $this->getProvisioningId() !== null;
}
public function jsonSerialize(): array {
#[ReturnTypeWillChange]
public function jsonSerialize() {
return [
'id' => $this->getId(),
'name' => $this->getName(),

Просмотреть файл

@ -26,6 +26,7 @@ namespace OCA\Mail\Db;
use JsonSerializable;
use OCP\AppFramework\Db\Entity;
use ReturnTypeWillChange;
/**
* @method string getUserId()
@ -56,6 +57,7 @@ class LocalAttachment extends Entity implements JsonSerializable {
/** @var int|null */
protected $localMessageId;
#[ReturnTypeWillChange]
public function jsonSerialize() {
return [
'id' => $this->id,

Просмотреть файл

@ -27,6 +27,7 @@ namespace OCA\Mail\Db;
use JsonSerializable;
use OCP\AppFramework\Db\Entity;
use ReturnTypeWillChange;
use function array_filter;
/**
@ -92,9 +93,7 @@ class LocalMessage extends Entity implements JsonSerializable {
$this->addType('html', 'boolean');
}
/**
* @return array
*/
#[ReturnTypeWillChange]
public function jsonSerialize() {
return [
'id' => $this->getId(),

Просмотреть файл

@ -28,6 +28,7 @@ namespace OCA\Mail\Db;
use JsonSerializable;
use OCA\Mail\IMAP\MailboxStats;
use OCP\AppFramework\Db\Entity;
use ReturnTypeWillChange;
use function base64_encode;
use function in_array;
use function json_decode;
@ -146,6 +147,7 @@ class Mailbox extends Entity implements JsonSerializable {
return new MailboxStats($this->getMessages(), $this->getUnseen());
}
#[ReturnTypeWillChange]
public function jsonSerialize() {
$specialUse = $this->getSpecialUseParsed();
return [

Просмотреть файл

@ -29,6 +29,7 @@ use Horde_Mail_Rfc822_Identification;
use JsonSerializable;
use OCA\Mail\AddressList;
use OCP\AppFramework\Db\Entity;
use ReturnTypeWillChange;
use function in_array;
use function json_decode;
use function json_encode;
@ -274,6 +275,7 @@ class Message extends Entity implements JsonSerializable {
}
}
#[ReturnTypeWillChange]
public function jsonSerialize() {
$tags = $this->getTags();
$indexed = array_combine(

Просмотреть файл

@ -28,6 +28,7 @@ namespace OCA\Mail\Db;
use JsonSerializable;
use OCP\AppFramework\Db\Entity;
use OCP\IUser;
use ReturnTypeWillChange;
/**
* @method string getProvisioningDomain()
@ -97,9 +98,7 @@ class Provisioning extends Entity implements JsonSerializable {
$this->addType('ldapAliasesProvisioning', 'boolean');
}
/**
* @return array
*/
#[ReturnTypeWillChange]
public function jsonSerialize() {
return [
'id' => $this->getId(),

Просмотреть файл

@ -28,6 +28,7 @@ namespace OCA\Mail\Db;
use JsonSerializable;
use OCP\AppFramework\Db\Entity;
use ReturnTypeWillChange;
/**
* @method int|null getMessageId()
@ -72,7 +73,8 @@ class Recipient extends Entity implements JsonSerializable {
$this->addType('mailboxType', 'integer');
}
public function jsonSerialize(): array {
#[ReturnTypeWillChange]
public function jsonSerialize() {
return [
'id' => $this->getId(),
'messageId' => $this->getMessageId(),

Просмотреть файл

@ -27,6 +27,7 @@ namespace OCA\Mail\Db;
use JsonSerializable;
use OCP\AppFramework\Db\Entity;
use ReturnTypeWillChange;
/**
* @method string getUserId()
@ -56,9 +57,8 @@ class Tag extends Entity implements JsonSerializable {
public function __construct() {
$this->addType('isDefaultTag', 'boolean');
}
/**
* @return array
*/
#[ReturnTypeWillChange]
public function jsonSerialize() {
return [
'id' => $this->getId(),

Просмотреть файл

@ -27,6 +27,7 @@ namespace OCA\Mail\Db;
use JsonSerializable;
use OCP\AppFramework\Db\Entity;
use ReturnTypeWillChange;
/**
* @method setEmail(string $email): void
@ -47,6 +48,7 @@ class TrustedSender extends Entity implements JsonSerializable {
/** @var string */
protected $type;
#[ReturnTypeWillChange]
public function jsonSerialize() {
return [
'id' => $this->id,

Просмотреть файл

@ -27,6 +27,7 @@ declare(strict_types=1);
namespace OCA\Mail\IMAP;
use JsonSerializable;
use ReturnTypeWillChange;
class MailboxStats implements JsonSerializable {
@ -55,6 +56,7 @@ class MailboxStats implements JsonSerializable {
return $this->unread;
}
#[ReturnTypeWillChange]
public function jsonSerialize() {
return [
'total' => $this->total,

Просмотреть файл

@ -25,6 +25,7 @@ namespace OCA\Mail\IMAP\Sync;
use JsonSerializable;
use OCA\Mail\IMAP\MailboxStats;
use ReturnTypeWillChange;
/**
* @psalm-template T
@ -87,7 +88,8 @@ class Response implements JsonSerializable {
return $this->stats;
}
public function jsonSerialize(): array {
#[ReturnTypeWillChange]
public function jsonSerialize() {
return [
'newMessages' => $this->newMessages,
'changedMessages' => $this->changedMessages,

Просмотреть файл

@ -26,6 +26,7 @@ declare(strict_types=1);
namespace OCA\Mail\IMAP\Threading;
use JsonSerializable;
use ReturnTypeWillChange;
use function array_map;
use function array_merge;
use function json_decode;
@ -104,7 +105,8 @@ class DatabaseMessage extends Message implements JsonSerializable {
);
}
public function jsonSerialize(): array {
#[ReturnTypeWillChange]
public function jsonSerialize() {
return array_merge(
parent::jsonSerialize(),
[

Просмотреть файл

@ -26,6 +26,7 @@ declare(strict_types=1);
namespace OCA\Mail\IMAP\Threading;
use JsonSerializable;
use ReturnTypeWillChange;
use function str_replace;
use function strpos;
@ -74,7 +75,8 @@ class Message implements JsonSerializable {
return $this->references;
}
public function jsonSerialize(): array {
#[ReturnTypeWillChange]
public function jsonSerialize() {
return [
'subject' => $this->subject,
'id' => $this->id,

Просмотреть файл

@ -52,6 +52,7 @@ use OCA\Mail\Service\Html;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\Files\File;
use OCP\Files\SimpleFS\ISimpleFile;
use ReturnTypeWillChange;
use function fclose;
use function in_array;
use function mb_convert_encoding;
@ -494,10 +495,8 @@ class IMAPMessage implements IMessage, JsonSerializable {
return $data;
}
/**
* @return array
*/
public function jsonSerialize(): array {
#[ReturnTypeWillChange]
public function jsonSerialize() {
return [
'uid' => $this->getUid(),
'messageId' => $this->getMessageId(),

Просмотреть файл

@ -27,6 +27,7 @@ declare(strict_types=1);
namespace OCA\Mail\Service\Avatar;
use JsonSerializable;
use ReturnTypeWillChange;
/**
* @psalm-immutable
@ -76,10 +77,8 @@ class Avatar implements JsonSerializable {
return $this->isExternal;
}
/**
* @return array
*/
public function jsonSerialize(): array {
#[ReturnTypeWillChange]
public function jsonSerialize() {
return [
'isExternal' => $this->isExternal,
'mime' => $this->mime,

Просмотреть файл

@ -26,6 +26,7 @@ declare(strict_types=1);
namespace OCA\Mail\Service;
use JsonSerializable;
use ReturnTypeWillChange;
class Quota implements JsonSerializable {
@ -49,6 +50,7 @@ class Quota implements JsonSerializable {
return $this->limit;
}
#[ReturnTypeWillChange]
public function jsonSerialize() {
return [
'usage' => $this->getUsage(),

Просмотреть файл

@ -19,7 +19,17 @@
~ You should have received a copy of the GNU Affero General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="bootstrap.php" verbose="true" timeoutForSmallTests="900" timeoutForMediumTests="900" timeoutForLargeTests="900" cacheResult="true" convertDeprecationsToExceptions="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="bootstrap.php"
verbose="true"
timeoutForSmallTests="900"
timeoutForMediumTests="900"
timeoutForLargeTests="900"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
cacheResult="true"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory suffix=".php">../lib</directory>

Просмотреть файл

@ -1,5 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="bootstrap.php" verbose="true" timeoutForSmallTests="900" timeoutForMediumTests="900" timeoutForLargeTests="900" cacheResult="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="bootstrap.php"
verbose="true"
timeoutForSmallTests="900"
timeoutForMediumTests="900"
timeoutForLargeTests="900"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
cacheResult="true"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory suffix=".php">../lib</directory>