diff options
author | George Peter Banyard <girgias@php.net> | 2020-12-01 01:43:17 +0000 |
---|---|---|
committer | George Peter Banyard <girgias@php.net> | 2020-12-03 17:43:08 +0000 |
commit | 426fe2f20c4e85c34f118ca891c99f70def1c8a8 (patch) | |
tree | a71543eef534de1422f840ccfcbdc2a9e76ff5bd /ext/imap/tests/imap_savebody_errors.phpt | |
parent | e45cc31c41355bed684164856470979a280084fb (diff) | |
download | php-git-426fe2f20c4e85c34f118ca891c99f70def1c8a8.tar.gz |
Standardize behaviour for int message number between functions
Diffstat (limited to 'ext/imap/tests/imap_savebody_errors.phpt')
-rw-r--r-- | ext/imap/tests/imap_savebody_errors.phpt | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/ext/imap/tests/imap_savebody_errors.phpt b/ext/imap/tests/imap_savebody_errors.phpt new file mode 100644 index 0000000000..e7cff603f6 --- /dev/null +++ b/ext/imap/tests/imap_savebody_errors.phpt @@ -0,0 +1,49 @@ +--TEST-- +imap_savebody() errors: ValueError and Warnings +--SKIPIF-- +<?php +require_once(__DIR__.'/setup/skipif.inc'); +?> +--FILE-- +<?php + +require_once(__DIR__.'/setup/imap_include.inc'); + +$imap_mail_box = setup_test_mailbox("imapsavebodyerrors", 0); + +$section = ''; + +try { + imap_savebody($imap_mail_box, '', -1, $section); +} catch (\ValueError $e) { + echo $e->getMessage() . \PHP_EOL; +} +try { + imap_savebody($imap_mail_box, '', 1, $section, -1); +} catch (\ValueError $e) { + echo $e->getMessage() . \PHP_EOL; +} + +// Access not existing +var_dump(imap_savebody($imap_mail_box, '', 255, $section)); +var_dump(imap_savebody($imap_mail_box, '', 255, $section, FT_UID)); + +imap_close($imap_mail_box); + +?> +--CLEAN-- +<?php +$mailbox_suffix = 'imapsavebodyerrors'; +require_once(__DIR__ . '/setup/clean.inc'); +?> +--EXPECTF-- +Create a temporary mailbox and add 0 msgs +New mailbox created +imap_savebody(): Argument #3 ($message_num) must be greater than 0 +imap_savebody(): Argument #5 ($flags) must be a bitmask of FT_UID, FT_PEEK, and FT_INTERNAL + +Warning: imap_savebody(): Bad message number in %s on line %d +bool(false) + +Warning: imap_savebody(): UID does not exist in %s on line %d +bool(false) |