Skip to content

Commit 5aaffc8

Browse files
committed
Backport IMAP test modernization to PHP-8.0 branch
Closes GH-6476
1 parent 83cf4aa commit 5aaffc8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+493
-477
lines changed

azure/setup.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ steps:
2020
set -e
2121
sudo groupadd -g 5000 vmail
2222
sudo useradd -m -d /var/vmail -s /bin/false -u 5000 -g vmail vmail
23-
sudo cp ext/imap/tests/dovecot.conf /etc/dovecot/dovecot.conf
24-
sudo cp ext/imap/tests/dovecotpass /etc/dovecot/dovecotpass
23+
sudo cp ext/imap/tests/setup/dovecot.conf /etc/dovecot/dovecot.conf
24+
sudo cp ext/imap/tests/setup/dovecotpass /etc/dovecot/dovecotpass
2525
sudo service dovecot restart
2626
displayName: 'Configure IMAP'
2727

ext/imap/tests/CONFLICTS

Lines changed: 0 additions & 1 deletion
This file was deleted.

ext/imap/tests/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ hMailServer on Windows. The tests are intended to be mailserver agnostic.
1111

1212
## Set-up tests on Ubuntu (checked on Ubuntu 18.04 (Bionic))
1313
The necessary packages can be installed using the following command;
14-
`apt-get install libc-client-dev libkrb5-dev dovecot-core dovecot-pop3d dovecot-imapd`
14+
`apt-get install libc-client-dev libkrb5-dev dovecot-core dovecot-pop3d dovecot-imapd sendmail`
1515

1616
The build of PHP will need to be compiled with the following flags:
1717
```
1818
--with-imap --with-kerberos --with-imap-ssl
1919
```
2020

21-
Then run the set-up script `ext/imap/tests/setup.sh` which will add the `vmail`
21+
Then run the set-up script `ext/imap/tests/setup/setup.sh` which will add the `vmail`
2222
group and user which is used by Dovecot for the mailbox. It will also copy the
23-
`ext/imap/tests/dovecot.conf` and `ext/imap/tests/dovecotpass` to the correct
23+
`ext/imap/tests/setup/dovecot.conf` and `ext/imap/tests/setup/dovecotpass` to the correct
2424
location for Dovecot and restarts it for the new configuration to be enabled.

ext/imap/tests/bug31142_2.phpt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
Bug #31142 test #2 (imap_mail_compose() generates incorrect output)
33
--SKIPIF--
44
<?php
5-
if (!extension_loaded("imap")) {
6-
die("skip imap extension not available");
7-
}
5+
extension_loaded('imap') or die('skip imap extension not available in this build');
86
?>
97
--FILE--
108
<?php

ext/imap/tests/bug32589.phpt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
Bug #32589 (crash inside imap_mail_compose() function)
33
--SKIPIF--
44
<?php
5-
if (!extension_loaded("imap")) {
6-
die("skip imap extension not available");
7-
}
5+
extension_loaded('imap') or die('skip imap extension not available in this build');
86
?>
97
--FILE--
108
<?php

ext/imap/tests/bug35669.phpt

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,43 @@
22
Bug #35669 (imap_mail_compose() crashes with multipart-multiboundary-email)
33
--SKIPIF--
44
<?php
5-
if (!extension_loaded("imap")) {
6-
die("skip imap extension not available");
7-
}
5+
extension_loaded('imap') or die('skip imap extension not available in this build');
86
?>
97
--FILE--
108
<?php
11-
$envelope["from"] = 'Santa <[email protected]>';
12-
$envelope["to"] = 'The bad smurf <[email protected]>';
13-
$envelope['date'] = 'Wed, 04 Jan 2006 19:24:43 -0500';
9+
$envelope["from"] = 'Santa <[email protected]>';
10+
$envelope["to"] = 'The bad smurf <[email protected]>';
11+
$envelope['date'] = 'Wed, 04 Jan 2006 19:24:43 -0500';
1412

15-
$multipart["type"] = TYPEMULTIPART;
16-
$multipart["subtype"] = "MIXED";
17-
$body[] = $multipart; //add multipart stuff
13+
$multipart["type"] = TYPEMULTIPART;
14+
$multipart["subtype"] = "MIXED";
15+
$body[] = $multipart; //add multipart stuff
1816

19-
$textpart["type"] = TYPEMULTIPART;
20-
$textpart["subtype"] = "ALTERNATIVE";
21-
$body[] = $textpart; //add body part
17+
$textpart["type"] = TYPEMULTIPART;
18+
$textpart["subtype"] = "ALTERNATIVE";
19+
$body[] = $textpart; //add body part
2220

23-
$plain["type"] = TYPETEXT;
24-
$plain["subtype"] = "PLAIN";
25-
$plain["charset"] = "iso-8859-1";
26-
$plain["encoding"] = ENCQUOTEDPRINTABLE;
27-
$plain["description"] = "Plaintype part of message";
28-
$plain['disposition'] = "inline";
29-
$plain["contents.data"] = 'See mom, it will crash';
21+
$plain["type"] = TYPETEXT;
22+
$plain["subtype"] = "PLAIN";
23+
$plain["charset"] = "iso-8859-1";
24+
$plain["encoding"] = ENCQUOTEDPRINTABLE;
25+
$plain["description"] = "Plaintype part of message";
26+
$plain['disposition'] = "inline";
27+
$plain["contents.data"] = 'See mom, it will crash';
3028

31-
$body[] = $plain; //next add plain text part
29+
$body[] = $plain; //next add plain text part
3230

33-
$html["type"] = TYPETEXT;
34-
$html["subtype"] = "HTML";
35-
$html["charset"] = "iso-8859-1";
36-
$html["encoding"] = ENCQUOTEDPRINTABLE;
37-
$html["description"] = "HTML part of message";
38-
$html['disposition'] = "inline";
39-
$html["contents.data"] = 'See mom, it will <b>crash</b>';
31+
$html["type"] = TYPETEXT;
32+
$html["subtype"] = "HTML";
33+
$html["charset"] = "iso-8859-1";
34+
$html["encoding"] = ENCQUOTEDPRINTABLE;
35+
$html["description"] = "HTML part of message";
36+
$html['disposition'] = "inline";
37+
$html["contents.data"] = 'See mom, it will <b>crash</b>';
4038

41-
$body[] = $html;
39+
$body[] = $html;
4240

43-
echo imap_mail_compose($envelope, $body);
41+
echo imap_mail_compose($envelope, $body);
4442
?>
4543
--EXPECTF--
4644
Date: Wed, 04 Jan 2006 19:24:43 -0500

ext/imap/tests/bug44098.phpt

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,14 @@
22
Bug #44098 (imap_utf8() returns only capital letters)
33
--SKIPIF--
44
<?php
5-
if (!extension_loaded("imap")) {
6-
die("skip imap extension not available");
7-
}
5+
extension_loaded('imap') or die('skip imap extension not available in this build');
86
?>
97
--FILE--
108
<?php
119
$exp = 'Luzon®14 dot CoM';
1210
$res = imap_utf8('=?iso-8859-1?b?THV6b26uMTQ=?= dot CoM');
13-
if ($res != $exp) {
14-
echo "failed: got <$res>, expected <exp>\n";
15-
} else {
16-
echo "ok";
17-
}
11+
var_dump($res);
12+
1813
?>
1914
--EXPECT--
20-
ok
15+
string(17) "Luzon®14 dot CoM"

ext/imap/tests/bug45705_1.phpt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
Bug #45705 test #1 (imap rfc822_parse_adrlist() modifies passed address parameter)
33
--SKIPIF--
44
<?php
5-
if (!extension_loaded("imap")) {
6-
die("skip imap extension not available");
7-
}
5+
extension_loaded('imap') or die('skip imap extension not available in this build');
86
?>
97
--FILE--
108
<?php

ext/imap/tests/bug45705_2.phpt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
Bug #45705 test #2 (imap rfc822_parse_adrlist() modifies passed address parameter)
33
--SKIPIF--
44
<?php
5-
if (!extension_loaded("imap")) {
6-
die("skip imap extension not available");
7-
}
5+
extension_loaded('imap') or die('skip imap extension not available in this build');
86
?>
97
--FILE--
108
<?php

ext/imap/tests/bug53377.phpt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
Bug #53377 (imap_mime_header_decode() doesn't ignore \t during long MIME header unfolding)
33
--SKIPIF--
44
<?php
5-
if (!extension_loaded("imap")) {
6-
die("skip imap extension not available");
7-
}
5+
extension_loaded('imap') or die('skip imap extension not available in this build');
86
?>
97
--FILE--
108
<?php

0 commit comments

Comments
 (0)