1--TEST--
2Test imap_clearflag_full() function : basic functionality
3--SKIPIF--
4<?php
5require_once(dirname(__FILE__).'/skipif.inc');
6?>
7--FILE--
8<?php
9/* Prototype  : bool imap_clearflag_full  ( resource $imap_stream  , string $sequence  , string $flag  [, string $options  ] )
10 * Description: Clears flags on messages.
11 * Source code: ext/imap/php_imap.c
12 */
13
14echo "*** Testing imap_clearflag_full() : basic functionality ***\n";
15
16require_once(dirname(__FILE__).'/imap_include.inc');
17
18echo "Create a new mailbox for test\n";
19$imap_stream = setup_test_mailbox("", 10);
20if (!is_resource($imap_stream)) {
21	exit("TEST FAILED: Unable to create test mailbox\n");
22}
23
24$check = imap_check($imap_stream);
25echo "Initial msg count in new_mailbox : ". $check->Nmsgs . "\n";
26
27echo "Set some flags\n";
28var_dump(imap_setflag_full($imap_stream, "1,3", "\\Seen \\Answered"));
29var_dump(imap_setflag_full($imap_stream, "2,4", "\\Answered"));
30var_dump(imap_setflag_full($imap_stream, "5,7", "\\Flagged \\Deleted"));
31var_dump(imap_setflag_full($imap_stream, "6,8", "\\Deleted"));
32var_dump(imap_setflag_full($imap_stream, "9,10", "\\Draft \\Flagged"));
33
34var_dump(imap_search($imap_stream, "SEEN"));
35var_dump(imap_search($imap_stream, "ANSWERED"));
36var_dump(imap_search($imap_stream, "FLAGGED"));
37var_dump(imap_search($imap_stream, "DELETED"));
38
39var_dump(imap_clearflag_full($imap_stream, "1,4", "\\Answered"));
40var_dump(imap_clearflag_full($imap_stream, "5,6,7,8", "\\Deleted"));
41var_dump(imap_clearflag_full($imap_stream, "9", "\\Flagged"));
42
43var_dump(imap_search($imap_stream, "SEEN"));
44var_dump(imap_search($imap_stream, "ANSWERED"));
45var_dump(imap_search($imap_stream, "FLAGGED"));
46var_dump(imap_search($imap_stream, "DELETED"));
47
48imap_close($imap_stream);
49?>
50===Done===
51--CLEAN--
52<?php
53require_once('clean.inc');
54?>
55--EXPECTF--
56*** Testing imap_clearflag_full() : basic functionality ***
57Create a new mailbox for test
58Create a temporary mailbox and add 10 msgs
59.. mailbox '{%s}%s' created
60Initial msg count in new_mailbox : 10
61Set some flags
62bool(true)
63bool(true)
64bool(true)
65bool(true)
66bool(true)
67array(2) {
68  [0]=>
69  int(1)
70  [1]=>
71  int(3)
72}
73array(4) {
74  [0]=>
75  int(1)
76  [1]=>
77  int(2)
78  [2]=>
79  int(3)
80  [3]=>
81  int(4)
82}
83array(4) {
84  [0]=>
85  int(5)
86  [1]=>
87  int(7)
88  [2]=>
89  int(9)
90  [3]=>
91  int(10)
92}
93array(4) {
94  [0]=>
95  int(5)
96  [1]=>
97  int(6)
98  [2]=>
99  int(7)
100  [3]=>
101  int(8)
102}
103bool(true)
104bool(true)
105bool(true)
106array(2) {
107  [0]=>
108  int(1)
109  [1]=>
110  int(3)
111}
112array(2) {
113  [0]=>
114  int(2)
115  [1]=>
116  int(3)
117}
118array(3) {
119  [0]=>
120  int(5)
121  [1]=>
122  int(7)
123  [2]=>
124  int(10)
125}
126bool(false)
127===Done===
128