1--TEST--
2Test imap_fetch_overview() function : usage variations - FT_UID option
3--SKIPIF--
4<?php
5require_once(__DIR__.'/setup/skipif.inc');
6?>
7--FILE--
8<?php
9/*
10 * Test passing a range of values into the $flags argument to imap_fetch_overview():
11 * 1. values that equate to 1
12 * 2. Minimum and maximum PHP values
13 */
14
15echo "*** Testing imap_fetch_overview() : usage variations ***\n";
16
17require_once __DIR__.'/setup/imap_include.inc';
18
19// Initialise required variables
20$stream_id = setup_test_mailbox('imapfetchoverviewvar3', 1); // set up temporary mailbox with one simple message
21$msg_no = 1;
22$msg_uid = imap_uid($stream_id, $msg_no);
23
24$flags = [
25    '1',
26    true,
27    1.000000000000001,
28    0.00001e5,
29    245,
30];
31
32imap_check($stream_id);
33foreach($flags as $option) {
34    echo "\nTesting with option value:";
35    var_dump($option);
36    try {
37        $overview = imap_fetch_overview($stream_id, $msg_uid, $option);
38        if ($overview) {
39            echo "imap_fetch_overview() returns an object\n";
40        }
41    } catch (\ValueError $e) {
42        echo $e->getMessage() . \PHP_EOL;
43    }
44}
45
46?>
47--CLEAN--
48<?php
49$mailbox_suffix = 'imapfetchoverviewvar3';
50require_once(__DIR__.'/setup/clean.inc');
51?>
52--EXPECT--
53*** Testing imap_fetch_overview() : usage variations ***
54Create a temporary mailbox and add 1 msgs
55New mailbox created
56
57Testing with option value:string(1) "1"
58imap_fetch_overview() returns an object
59
60Testing with option value:bool(true)
61imap_fetch_overview() returns an object
62
63Testing with option value:float(1.000000000000001)
64imap_fetch_overview() returns an object
65
66Testing with option value:float(1)
67imap_fetch_overview() returns an object
68
69Testing with option value:int(245)
70imap_fetch_overview(): Argument #3 ($flags) must be FT_UID or 0
71