summaryrefslogtreecommitdiff
path: root/ext/imap/tests/imap_setflag_full_uid.phpt
blob: 86654213908e8aa857f8bf0ea6a6f5cd3fe154d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
--TEST--
imap_setflag_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("imapsetflagfulluid");

/* This works on the assumption that UID message 3 to 6 inclusive are deleted. */

// Testing individual entry
imap_setflag_full($imap_mail_box, '8', '\Answered', ST_UID);

// Testing multiple entries entry
imap_setflag_full($imap_mail_box, '7,10', '\Deleted', ST_UID);

// Testing entry range
imap_setflag_full($imap_mail_box, '7:9', '\Flagged', ST_UID);

// Testing entry range invalid
var_dump(imap_setflag_full($imap_mail_box, '4:9', '\Seen', 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'));
echo 'SEEN: ';
var_dump(imap_search($imap_mail_box, 'SEEN'));

imap_close($imap_mail_box);

?>
--CLEAN--
<?php
$mailbox_suffix = 'imapsetflagfulluid';
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)
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(2) {
  [0]=>
  int(3)
  [1]=>
  int(6)
}
FLAGGED: array(3) {
  [0]=>
  int(3)
  [1]=>
  int(4)
  [2]=>
  int(5)
}
SEEN: array(3) {
  [0]=>
  int(3)
  [1]=>
  int(4)
  [2]=>
  int(5)
}