diff options
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/managesieve/tests/parser.phpt | 45 | ||||
| -rw-r--r-- | plugins/managesieve/tests/parser_imapflags.phpt | 28 | ||||
| -rw-r--r-- | plugins/managesieve/tests/parser_relational.phpt | 25 | ||||
| -rw-r--r-- | plugins/managesieve/tests/parser_vacation.phpt | 39 |
4 files changed, 94 insertions, 43 deletions
diff --git a/plugins/managesieve/tests/parser.phpt b/plugins/managesieve/tests/parser.phpt index d70353459..308617296 100644 --- a/plugins/managesieve/tests/parser.phpt +++ b/plugins/managesieve/tests/parser.phpt @@ -6,7 +6,7 @@ Main test of script parser include '../lib/rcube_sieve_script.php'; $txt = ' -require ["fileinto","vacation","reject","relational","comparator-i;ascii-numeric","imapflags"]; +require ["fileinto","reject"]; # rule:[spam] if anyof (header :contains "X-DSPAM-Result" "Spam") { @@ -25,17 +25,6 @@ if anyof (not header :contains ["Subject"] "[test]", header :contains "Subject" fileinto "test"; stop; } -# rule:[test-vacation] -if anyof (header :contains "Subject" "vacation") -{ - vacation :days 1 text: -# test -test test /* test */ -test -. -; - stop; -} # rule:[comments] if anyof (true) /* comment * "comment" #comment */ { @@ -46,14 +35,6 @@ if anyof (true) /* comment if size :over 5000K { reject "Message over 5MB size limit. Please contact me before sending this."; } -# rule:[redirect] -if header :value "ge" :comparator "i;ascii-numeric" - ["X-Spam-score"] ["14"] {redirect "test@test.tld";} -# rule:[imapflags] -if header :matches "Subject" "^Test$" { - setflag "\\\\Seen"; - addflag ["\\\\Answered","\\\\Deleted"]; -} '; $s = new rcube_sieve_script($txt); @@ -61,7 +42,7 @@ echo $s->as_text(); ?> --EXPECT-- -require ["fileinto","vacation","reject","relational","comparator-i;ascii-numeric","imapflags"]; +require ["fileinto","reject"]; # rule:[spam] if header :contains "X-DSPAM-Result" "Spam" { @@ -80,17 +61,6 @@ if anyof (not header :contains "Subject" "[test]", header :contains "Subject" "[ fileinto "test"; stop; } -# rule:[test-vacation] -if header :contains "Subject" "vacation" -{ - vacation :days 1 text: -# test -test test /* test */ -test -. -; - stop; -} # rule:[comments] if true { @@ -101,14 +71,3 @@ if size :over 5000K { reject "Message over 5MB size limit. Please contact me before sending this."; } -# rule:[redirect] -if header :value "ge" :comparator "i;ascii-numeric" "X-Spam-score" "14" -{ - redirect "test@test.tld"; -} -# rule:[imapflags] -if header :matches "Subject" "^Test$" -{ - setflag "\\Seen"; - addflag ["\\Answered","\\Deleted"]; -} diff --git a/plugins/managesieve/tests/parser_imapflags.phpt b/plugins/managesieve/tests/parser_imapflags.phpt new file mode 100644 index 000000000..025927267 --- /dev/null +++ b/plugins/managesieve/tests/parser_imapflags.phpt @@ -0,0 +1,28 @@ +--TEST-- +Test of Sieve vacation extension (RFC5232) +--SKIPIF-- +--FILE-- +<?php +include '../lib/rcube_sieve_script.php'; + +$txt = ' +require ["imapflags"]; +# rule:[imapflags] +if header :matches "Subject" "^Test$" { + setflag "\\\\Seen"; + addflag ["\\\\Answered","\\\\Deleted"]; +} +'; + +$s = new rcube_sieve_script($txt); +echo $s->as_text(); + +?> +--EXPECT-- +require ["imapflags"]; +# rule:[imapflags] +if header :matches "Subject" "^Test$" +{ + setflag "\\Seen"; + addflag ["\\Answered","\\Deleted"]; +} diff --git a/plugins/managesieve/tests/parser_relational.phpt b/plugins/managesieve/tests/parser_relational.phpt new file mode 100644 index 000000000..6b6f29f4c --- /dev/null +++ b/plugins/managesieve/tests/parser_relational.phpt @@ -0,0 +1,25 @@ +--TEST-- +Test of Sieve relational extension (RFC5231) +--SKIPIF-- +--FILE-- +<?php +include '../lib/rcube_sieve_script.php'; + +$txt = ' +require ["relational","comparator-i;ascii-numeric"]; +# rule:[redirect] +if header :value "ge" :comparator "i;ascii-numeric" + ["X-Spam-score"] ["14"] {redirect "test@test.tld";} +'; + +$s = new rcube_sieve_script($txt); +echo $s->as_text(); + +?> +--EXPECT-- +require ["relational","comparator-i;ascii-numeric"]; +# rule:[redirect] +if header :value "ge" :comparator "i;ascii-numeric" "X-Spam-score" "14" +{ + redirect "test@test.tld"; +} diff --git a/plugins/managesieve/tests/parser_vacation.phpt b/plugins/managesieve/tests/parser_vacation.phpt new file mode 100644 index 000000000..a603ff6c1 --- /dev/null +++ b/plugins/managesieve/tests/parser_vacation.phpt @@ -0,0 +1,39 @@ +--TEST-- +Test of Sieve vacation extension (RFC5230) +--SKIPIF-- +--FILE-- +<?php +include '../lib/rcube_sieve_script.php'; + +$txt = ' +require ["vacation"]; +# rule:[test-vacation] +if anyof (header :contains "Subject" "vacation") +{ + vacation :days 1 text: +# test +test test /* test */ +test +. +; + stop; +} +'; + +$s = new rcube_sieve_script($txt); +echo $s->as_text(); + +?> +--EXPECT-- +require ["vacation"]; +# rule:[test-vacation] +if header :contains "Subject" "vacation" +{ + vacation :days 1 text: +# test +test test /* test */ +test +. +; + stop; +} |
