Skip to content

Commit 4b892bf

Browse files
Add PHP8.1 support
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
1 parent 63e8dc3 commit 4b892bf

File tree

11 files changed

+83
-27
lines changed

11 files changed

+83
-27
lines changed

.github/workflows/lint.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
runs-on: ubuntu-latest
2020
strategy:
2121
matrix:
22-
php-versions: [7.4, 8.0]
22+
php-versions: ['7.4', '8.0', '8.1']
2323
name: php${{ matrix.php-versions }} lint
2424
steps:
2525
- name: Checkout
@@ -41,7 +41,7 @@ jobs:
4141
- name: Set up php
4242
uses: shivammathur/setup-php@master
4343
with:
44-
php-version: 7.4
44+
php-version: '8.0'
4545
coverage: none
4646
- name: Install dependencies
4747
run: composer i

.github/workflows/test.yml

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,12 @@ jobs:
1212
runs-on: ubuntu-latest
1313
strategy:
1414
matrix:
15-
php-versions: [7.4]
15+
php-versions: ['8.0']
1616
nextcloud-versions: ['stable22', 'stable23']
1717
include:
1818
- php-versions: 7.4
1919
nextcloud-versions: stable24
20-
- php-versions: 8.0
21-
nextcloud-versions: stable24
22-
- php-versions: 7.4
23-
nextcloud-versions: master
24-
- php-versions: 8.0
20+
- php-versions: 8.1
2521
nextcloud-versions: master
2622
name: Nextcloud ${{ matrix.nextcloud-versions }} php${{ matrix.php-versions }} unit tests
2723
steps:
@@ -49,11 +45,18 @@ jobs:
4945
- name: Run tests
5046
working-directory: nextcloud/apps/mail
5147
run: composer run test:unit
48+
if: ${{ matrix.php-versions == '8.0' }}
5249
env:
5350
XDEBUG_MODE: coverage
51+
- name: Run tests
52+
working-directory: nextcloud/apps/mail
53+
run: composer run test:unit
54+
if: ${{ matrix.php-versions != '8.0' }}
55+
env:
56+
XDEBUG_MODE: off
5457
- name: Report coverage
5558
uses: codecov/codecov-action@v3.1.0
56-
if: ${{ always() && matrix.nextcloud-versions == 'master' }}
59+
if: ${{ always() && matrix.php-versions == '8.0' }}
5760
with:
5861
file: ./nextcloud/apps/mail/tests/clover.unit.xml
5962
flags: unittests
@@ -63,9 +66,19 @@ jobs:
6366
runs-on: ubuntu-latest
6467
strategy:
6568
matrix:
66-
php-versions: [7.4, 8.0]
69+
php-versions: ['8.0']
6770
nextcloud-versions: ['master']
6871
db: ['sqlite', 'mysql', 'pgsql']
72+
include:
73+
- php-versions: 7.4
74+
nextcloud-versions: stable22
75+
db: 'mysql'
76+
- php-versions: 8.0
77+
nextcloud-versions: stable23
78+
db: 'mysql'
79+
- php-versions: 8.1
80+
nextcloud-versions: stable24
81+
db: 'mysql'
6982
name: php${{ matrix.php-versions }}-${{ matrix.db }} integration tests
7083
services:
7184
mail-service:
@@ -138,12 +151,16 @@ jobs:
138151
echo "SET GLOBAL log_output = 'table';" | mysql -h 127.0.0.1 -u root -pmy-secret-pw
139152
- name: Run tests
140153
working-directory: nextcloud/apps/mail
141-
run: |
142-
ss -tunlp
143-
true | openssl s_client -crlf -connect 127.0.0.1:993
144-
composer run test:integration
154+
if: ${{ matrix.db == 'mysql' }}
155+
run: composer run test:integration
145156
env:
146157
XDEBUG_MODE: coverage
158+
- name: Run tests
159+
working-directory: nextcloud/apps/mail
160+
if: ${{ matrix.db != 'mysql' }}
161+
run: composer run test:integration
162+
env:
163+
XDEBUG_MODE: off
147164
- name: Read slow queries
148165
if: ${{ always() }}
149166
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

appinfo/info.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<repository type="git">https://github.com/nextcloud/mail.git</repository>
3030
<screenshot>https://user-images.githubusercontent.com/1374172/79554966-278e1600-809f-11ea-82ea-7a0d72a2704f.png</screenshot>
3131
<dependencies>
32-
<php min-version="7.4" max-version="8.0" />
32+
<php min-version="7.4" max-version="8.1" />
3333
<nextcloud min-version="22" max-version="25" />
3434
</dependencies>
3535
<background-jobs>

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
}
1717
},
1818
"require": {
19-
"php": ">=7.4",
19+
"php": ">=7.4 <=8.1",
2020
"arthurhoaro/favicon": "^1.2",
2121
"bamarni/composer-bin-plugin": "^1.4",
2222
"bytestream/horde-exception": "^2.1",
@@ -69,9 +69,9 @@
6969
"\"vendor/bin/mozart\" compose",
7070
"composer dump-autoload"
7171
],
72-
"test:integration": "phpunit -c tests/phpunit.integration.xml --fail-on-warning",
72+
"test:integration": "phpunit -c tests/phpunit.integration.xml --testdox --debug -v",
7373
"test:integration:dev": "phpunit -c tests/phpunit.integration.xml --no-coverage --order-by=defects --stop-on-defect --fail-on-warning --stop-on-error --stop-on-failure",
74-
"test:unit": "phpunit -c tests/phpunit.unit.xml --fail-on-warning",
74+
"test:unit": "phpunit -c tests/phpunit.unit.xml --testdox --debug -v",
7575
"test:unit:dev": "phpunit -c tests/phpunit.unit.xml --no-coverage --order-by=defects --stop-on-defect --fail-on-warning --stop-on-error --stop-on-failure"
7676
},
7777
"extra": {

composer.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/Account.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public function __construct(MailAccount $account) {
8383

8484
public function __destruct() {
8585
if ($this->client !== null) {
86+
fwrite(STDERR, "DESTRUCT ACCOUNT\n");
8687
$this->client->logout();
8788
}
8889
}

lib/IMAP/IMAPClientFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public function getClient(Account $account, bool $useCache = true): Horde_Imap_C
8888
],
8989
],
9090
];
91-
if ($useCache && $this->cacheFactory->isAvailable()) {
91+
if (false && $useCache && $this->cacheFactory->isAvailable()) {
9292
$params['cache'] = [
9393
'backend' => new Cache([
9494
'cacheob' => $this->cacheFactory->createDistributed(md5((string)$account->getId())),

lib/Sieve/SieveLogger.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public function debug(string $message): void {
4040
}
4141

4242
public function __destruct() {
43+
fwrite(STDERR, "DESTRUCT SIEVE LOGGER\n");
4344
fflush($this->stream);
4445
fclose($this->stream);
4546
}

tests/Unit/BackgroundJob/SyncJobTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
use OCP\AppFramework\Db\DoesNotExistException;
3434
use OCP\ILogger;
3535
use OCP\IUser;
36+
use function fwrite;
3637

3738
class SyncJobTest extends TestCase {
3839

@@ -43,52 +44,68 @@ class SyncJobTest extends TestCase {
4344
private $job;
4445

4546
protected function setUp(): void {
47+
fwrite(STDERR, "1\n");
4648
parent::setUp();
49+
fwrite(STDERR, "2\n");
4750

4851
$this->serviceMock = $this->createServiceMock(SyncJob::class);
52+
fwrite(STDERR, "10\n");
4953
$this->job = $this->serviceMock->getService();
54+
fwrite(STDERR, "11\n");
5055

5156
// Make sure the job is actually run
5257
$this->serviceMock->getParameter('time')
5358
->method('getTime')
5459
->willReturn(500000);
60+
fwrite(STDERR, "12\n");
5561
// Set our common argument
5662
$this->job->setArgument([
5763
'accountId' => 123,
5864
]);
65+
fwrite(STDERR, "13\n");
5966
// Set a fake ID
6067
$this->job->setId(99);
68+
fwrite(STDERR, "14\n");
6169
}
6270

6371
public function testAccountDoesntExist(): void {
72+
fwrite(STDERR, "TADE 1\n");
6473
$this->serviceMock->getParameter('accountService')
6574
->expects(self::once())
6675
->method('findById')
6776
->with(123)
6877
->willThrowException(new DoesNotExistException(''));
78+
fwrite(STDERR, "TADE 2\n");
6979
$this->serviceMock->getParameter('logger')
7080
->expects(self::once())
7181
->method('debug')
7282
->with('Could not find account <123> removing from jobs');
83+
fwrite(STDERR, "TADE 3\n");
7384
$this->serviceMock->getParameter('jobList')
7485
->expects(self::once())
7586
->method('remove')
7687
->with(SyncJob::class, ['accountId' => 123]);
88+
fwrite(STDERR, "TADE 4\n");
7789
$this->serviceMock->getParameter('mailboxSync')
7890
->expects(self::never())
7991
->method('sync');
92+
fwrite(STDERR, "TADE 5\n");
8093
$this->serviceMock->getParameter('syncService')
8194
->expects(self::never())
8295
->method('syncAccount');
96+
fwrite(STDERR, "TADE 6\n");
8397

8498
$this->job->setArgument([
8599
'accountId' => 123,
86100
]);
101+
fwrite(STDERR, "TADE 7\n");
87102
$this->job->setLastRun(0);
103+
fwrite(STDERR, "TADE 8\n");
88104
$this->job->execute(
89105
$this->createMock(JobList::class),
90106
$this->createMock(ILogger::class)
91107
);
108+
fwrite(STDERR, "TADE 9\n");
92109
}
93110

94111
public function testUserDoesntExist(): void {

tests/phpunit.integration.xml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,17 @@
1919
~ You should have received a copy of the GNU Affero General Public License
2020
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
2121
-->
22-
<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">
22+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
23+
bootstrap="bootstrap.php"
24+
verbose="true"
25+
timeoutForSmallTests="900"
26+
timeoutForMediumTests="900"
27+
timeoutForLargeTests="900"
28+
convertErrorsToExceptions="true"
29+
convertNoticesToExceptions="true"
30+
convertWarningsToExceptions="true"
31+
cacheResult="true"
32+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
2333
<coverage>
2434
<include>
2535
<directory suffix=".php">../lib</directory>

0 commit comments

Comments
 (0)