-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for passing a UID instead of a message number
- Loading branch information
Showing
17 changed files
with
708 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--TEST-- | ||
imap_body() passing a unique ID | ||
--SKIPIF-- | ||
<?php | ||
require_once(__DIR__.'/setup/skipif.inc'); | ||
?> | ||
--FILE-- | ||
<?php | ||
|
||
require_once(__DIR__.'/setup/imap_include.inc'); | ||
|
||
$imap_mail_box = setup_test_mailbox_for_uid_tests("imapbodyuid", $msg_no, $uid); | ||
|
||
var_dump(imap_body($imap_mail_box, $uid, FT_UID) === imap_body($imap_mail_box, $msg_no)); | ||
|
||
imap_close($imap_mail_box); | ||
|
||
?> | ||
--CLEAN-- | ||
<?php | ||
$mailbox_suffix = 'imapbodyuid'; | ||
require_once(__DIR__ . '/setup/clean.inc'); | ||
?> | ||
--EXPECT-- | ||
Create a temporary mailbox and add 10 msgs | ||
New mailbox created | ||
Delete 4 messages for Unique ID generation | ||
bool(true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
--TEST-- | ||
imap_clearflag_full() passing a unique ID | ||
--SKIPIF-- | ||
<?php | ||
require_once(__DIR__.'/setup/skipif.inc'); | ||
?> | ||
--FILE-- | ||
<?php | ||
|
||
require_once(__DIR__.'/setup/imap_include.inc'); | ||
|
||
$imap_mail_box = setup_test_mailbox_for_uid_tests("imapclearflagfulluid"); | ||
|
||
/* This works on the assumption that UID message 3 to 6 inclusive are deleted. */ | ||
|
||
imap_setflag_full($imap_mail_box, '2,8,9', '\Answered', ST_UID); | ||
imap_setflag_full($imap_mail_box, '7,10', '\Deleted', ST_UID); | ||
imap_setflag_full($imap_mail_box, '7:9', '\Flagged', ST_UID); | ||
|
||
// Testing individual entry | ||
imap_clearflag_full($imap_mail_box, '10', '\Deleted', ST_UID); | ||
// Testing multiple entries entry | ||
imap_clearflag_full($imap_mail_box, '2,9', '\Answered', ST_UID); | ||
// Testing entry range | ||
imap_clearflag_full($imap_mail_box, '7:8', '\Flagged', ST_UID); | ||
|
||
|
||
echo 'ALL: '; | ||
var_dump(imap_search($imap_mail_box, 'ALL')); | ||
echo 'ALL (with UID correspondance): '; | ||
var_dump(imap_search($imap_mail_box, 'ALL', SE_UID)); | ||
echo 'ANSWERED: '; | ||
var_dump(imap_search($imap_mail_box, 'ANSWERED')); | ||
echo 'DELETED: '; | ||
var_dump(imap_search($imap_mail_box, 'DELETED')); | ||
echo 'FLAGGED: '; | ||
var_dump(imap_search($imap_mail_box, 'FLAGGED')); | ||
|
||
imap_close($imap_mail_box); | ||
|
||
?> | ||
--CLEAN-- | ||
<?php | ||
$mailbox_suffix = 'imapclearflagfulluid'; | ||
require_once(__DIR__ . '/setup/clean.inc'); | ||
?> | ||
--EXPECT-- | ||
Create a temporary mailbox and add 10 msgs | ||
New mailbox created | ||
Delete 4 messages for Unique ID generation | ||
ALL: array(6) { | ||
[0]=> | ||
int(1) | ||
[1]=> | ||
int(2) | ||
[2]=> | ||
int(3) | ||
[3]=> | ||
int(4) | ||
[4]=> | ||
int(5) | ||
[5]=> | ||
int(6) | ||
} | ||
ALL (with UID correspondance): array(6) { | ||
[0]=> | ||
int(1) | ||
[1]=> | ||
int(2) | ||
[2]=> | ||
int(7) | ||
[3]=> | ||
int(8) | ||
[4]=> | ||
int(9) | ||
[5]=> | ||
int(10) | ||
} | ||
ANSWERED: array(1) { | ||
[0]=> | ||
int(4) | ||
} | ||
DELETED: array(1) { | ||
[0]=> | ||
int(3) | ||
} | ||
FLAGGED: array(1) { | ||
[0]=> | ||
int(5) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
--TEST-- | ||
imap_delete() passing a unique ID | ||
--SKIPIF-- | ||
<?php | ||
require_once(__DIR__.'/setup/skipif.inc'); | ||
?> | ||
--FILE-- | ||
<?php | ||
|
||
require_once(__DIR__.'/setup/imap_include.inc'); | ||
|
||
$imap_mail_box = setup_test_mailbox_for_uid_tests("imapdeleteuid", $msg_no, $uid); | ||
|
||
imap_delete($imap_mail_box, $uid, FT_UID); | ||
var_dump(imap_search($imap_mail_box, 'DELETED', SE_UID)); | ||
imap_expunge($imap_mail_box); | ||
|
||
echo 'After expunging: '; | ||
var_dump(imap_search($imap_mail_box, 'DELETED', SE_UID)); | ||
|
||
var_dump(imap_search($imap_mail_box, 'ALL', SE_UID)); | ||
|
||
imap_close($imap_mail_box); | ||
|
||
?> | ||
--CLEAN-- | ||
<?php | ||
$mailbox_suffix = 'imapdeleteuid'; | ||
require_once(__DIR__ . '/setup/clean.inc'); | ||
?> | ||
--EXPECT-- | ||
Create a temporary mailbox and add 10 msgs | ||
New mailbox created | ||
Delete 4 messages for Unique ID generation | ||
array(1) { | ||
[0]=> | ||
int(9) | ||
} | ||
After expunging: bool(false) | ||
array(5) { | ||
[0]=> | ||
int(1) | ||
[1]=> | ||
int(2) | ||
[2]=> | ||
int(7) | ||
[3]=> | ||
int(8) | ||
[4]=> | ||
int(10) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--TEST-- | ||
imap_fetch_overview() passing a unique ID | ||
--SKIPIF-- | ||
<?php | ||
require_once(__DIR__.'/setup/skipif.inc'); | ||
?> | ||
--FILE-- | ||
<?php | ||
|
||
require_once(__DIR__.'/setup/imap_include.inc'); | ||
|
||
$imap_mail_box = setup_test_mailbox_for_uid_tests("imapfetchoverviewuid", $msg_no, $uid); | ||
|
||
// Usage of == because comparing objects | ||
var_dump(imap_fetch_overview($imap_mail_box, $uid, FT_UID) == imap_fetch_overview($imap_mail_box, $msg_no)); | ||
|
||
imap_close($imap_mail_box); | ||
|
||
?> | ||
--CLEAN-- | ||
<?php | ||
$mailbox_suffix = 'imapfetchoverviewuid'; | ||
require_once(__DIR__ . '/setup/clean.inc'); | ||
?> | ||
--EXPECT-- | ||
Create a temporary mailbox and add 10 msgs | ||
New mailbox created | ||
Delete 4 messages for Unique ID generation | ||
bool(true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--TEST-- | ||
imap_fetchbody() passing a unique ID | ||
--SKIPIF-- | ||
<?php | ||
require_once(__DIR__.'/setup/skipif.inc'); | ||
?> | ||
--FILE-- | ||
<?php | ||
|
||
require_once(__DIR__.'/setup/imap_include.inc'); | ||
|
||
$imap_mail_box = setup_test_mailbox_for_uid_tests("imapfetchbodyuid", $msg_no, $uid); | ||
|
||
$section = '2'; | ||
var_dump(imap_fetchbody($imap_mail_box, $uid, $section, FT_UID) === imap_fetchbody($imap_mail_box, $msg_no, $section)); | ||
|
||
imap_close($imap_mail_box); | ||
|
||
?> | ||
--CLEAN-- | ||
<?php | ||
$mailbox_suffix = 'imapfetchbodyuid'; | ||
require_once(__DIR__ . '/setup/clean.inc'); | ||
?> | ||
--EXPECT-- | ||
Create a temporary mailbox and add 10 msgs | ||
New mailbox created | ||
Delete 4 messages for Unique ID generation | ||
bool(true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--TEST-- | ||
imap_fetchheader() passing a unique ID | ||
--SKIPIF-- | ||
<?php | ||
require_once(__DIR__.'/setup/skipif.inc'); | ||
?> | ||
--FILE-- | ||
<?php | ||
|
||
require_once(__DIR__.'/setup/imap_include.inc'); | ||
|
||
$imap_mail_box = setup_test_mailbox_for_uid_tests("imapfetchheaderuid", $msg_no, $uid); | ||
|
||
var_dump(imap_fetchheader($imap_mail_box, $uid, FT_UID) === imap_fetchheader($imap_mail_box, $msg_no)); | ||
|
||
imap_close($imap_mail_box); | ||
|
||
?> | ||
--CLEAN-- | ||
<?php | ||
$mailbox_suffix = 'imapfetchheaderuid'; | ||
require_once(__DIR__ . '/setup/clean.inc'); | ||
?> | ||
--EXPECT-- | ||
Create a temporary mailbox and add 10 msgs | ||
New mailbox created | ||
Delete 4 messages for Unique ID generation | ||
bool(true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--TEST-- | ||
imap_fetchmime() passing a unique ID | ||
--SKIPIF-- | ||
<?php | ||
require_once(__DIR__.'/setup/skipif.inc'); | ||
?> | ||
--FILE-- | ||
<?php | ||
|
||
require_once(__DIR__.'/setup/imap_include.inc'); | ||
|
||
$imap_mail_box = setup_test_mailbox_for_uid_tests("imapfetchmimeuid", $msg_no, $uid); | ||
|
||
$section = '2'; | ||
var_dump(imap_fetchbody($imap_mail_box, $uid, $section, FT_UID) === imap_fetchbody($imap_mail_box, $msg_no, $section)); | ||
|
||
imap_close($imap_mail_box); | ||
|
||
?> | ||
--CLEAN-- | ||
<?php | ||
$mailbox_suffix = 'imapfetchmimeuid'; | ||
require_once(__DIR__ . '/setup/clean.inc'); | ||
?> | ||
--EXPECT-- | ||
Create a temporary mailbox and add 10 msgs | ||
New mailbox created | ||
Delete 4 messages for Unique ID generation | ||
bool(true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--TEST-- | ||
imap_fetchstructure() passing a unique ID | ||
--SKIPIF-- | ||
<?php | ||
require_once(__DIR__.'/setup/skipif.inc'); | ||
?> | ||
--FILE-- | ||
<?php | ||
|
||
require_once(__DIR__.'/setup/imap_include.inc'); | ||
|
||
$imap_mail_box = setup_test_mailbox_for_uid_tests("imapfetchstructureuid", $msg_no, $uid); | ||
|
||
// Usage of == because comparing objects | ||
var_dump(imap_fetchstructure($imap_mail_box, $uid, FT_UID) == imap_fetchstructure($imap_mail_box, $msg_no)); | ||
|
||
imap_close($imap_mail_box); | ||
|
||
?> | ||
--CLEAN-- | ||
<?php | ||
$mailbox_suffix = 'imapfetchstructureuid'; | ||
require_once(__DIR__ . '/setup/clean.inc'); | ||
?> | ||
--EXPECT-- | ||
Create a temporary mailbox and add 10 msgs | ||
New mailbox created | ||
Delete 4 messages for Unique ID generation | ||
bool(true) |
Oops, something went wrong.