summaryrefslogtreecommitdiff
path: root/plugins/managesieve/tests/parser.phpt
diff options
context:
space:
mode:
authoralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2011-01-23 10:35:29 +0000
committeralec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c>2011-01-23 10:35:29 +0000
commit8148ffbbc015f3aeccfe1c7b6c460c5866f513c5 (patch)
tree5ecf884c5174a98d524d84751b12ab2d9da99ae5 /plugins/managesieve/tests/parser.phpt
parent6fe2e9bb18c88740a4cfb70c8b84cce394997898 (diff)
- More tests + some script output improvments
git-svn-id: https://svn.roundcube.net/trunk@4451 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'plugins/managesieve/tests/parser.phpt')
-rw-r--r--plugins/managesieve/tests/parser.phpt35
1 files changed, 26 insertions, 9 deletions
diff --git a/plugins/managesieve/tests/parser.phpt b/plugins/managesieve/tests/parser.phpt
index 27952eb1f..a3b820d45 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.php');
$txt = '
-require ["fileinto","vacation"];
+require ["fileinto","vacation","reject","relational","comparator-i;ascii-numeric"];
# rule:[spam]
if anyof (header :contains "X-DSPAM-Result" "Spam")
{
@@ -16,11 +16,11 @@ if anyof (header :contains "X-DSPAM-Result" "Spam")
# rule:[test1]
if anyof (header :contains ["From","To"] "test@domain.tld")
{
- fileinto "roundcube-trac";
+ discard;
stop;
}
# rule:[test2]
-if anyof (not header :contains "Subject" "[test]", header :contains "Subject" "[test2]")
+if anyof (not header :contains ["Subject"] "[test]", header :contains "Subject" "[test2]")
{
fileinto "test";
stop;
@@ -42,6 +42,13 @@ if anyof (true) /* comment
/* comment */ stop;
# comment
}
+# rule:[reject]
+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";}
';
$s = new rcube_sieve_script($txt);
@@ -49,17 +56,17 @@ echo $s->as_text();
?>
--EXPECT--
-require ["fileinto","vacation"];
+require ["fileinto","vacation","reject","relational","comparator-i;ascii-numeric"];
# rule:[spam]
-if anyof (header :contains "X-DSPAM-Result" "Spam")
+if header :contains "X-DSPAM-Result" "Spam"
{
fileinto "Spam";
stop;
}
# rule:[test1]
-if anyof (header :contains ["From","To"] "test@domain.tld")
+if header :contains ["From","To"] "test@domain.tld"
{
- fileinto "roundcube-trac";
+ discard;
stop;
}
# rule:[test2]
@@ -69,7 +76,7 @@ if anyof (not header :contains "Subject" "[test]", header :contains "Subject" "[
stop;
}
# rule:[test-vacation]
-if anyof (header :contains "Subject" "vacation")
+if header :contains "Subject" "vacation"
{
vacation :days 1 text:
# test
@@ -80,7 +87,17 @@ test
stop;
}
# rule:[comments]
-if anyof (true)
+if true
{
stop;
}
+# rule:[reject]
+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";
+}