diff options
author | Aleksander Machniak <alec@alec.pl> | 2012-09-19 11:14:23 +0200 |
---|---|---|
committer | Aleksander Machniak <alec@alec.pl> | 2012-09-19 11:14:23 +0200 |
commit | 7641e4aaab279e060cf4f4a981869f07f3a02f45 (patch) | |
tree | 759b9a1ab33f177fb96edfbf11bb3166a5e6cc5e /plugins/managesieve/tests | |
parent | e3dd1b77390c3d060ee0b18bfe287ed5078c5dc7 (diff) |
Improve capabilities list handling in parser tests
Diffstat (limited to 'plugins/managesieve/tests')
-rw-r--r-- | plugins/managesieve/tests/Parser.php | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/plugins/managesieve/tests/Parser.php b/plugins/managesieve/tests/Parser.php index 00915cc20..2f24870e2 100644 --- a/plugins/managesieve/tests/Parser.php +++ b/plugins/managesieve/tests/Parser.php @@ -15,7 +15,15 @@ class Parser extends PHPUnit_Framework_TestCase */ function test_parser($input, $output, $message) { - $script = new rcube_sieve_script($input); + // get capabilities list from the script + $caps = array(); + if (preg_match('/require \[([a-z0-9", ]+)\]/', $input, $m)) { + foreach (explode(',', $m[1]) as $cap) { + $caps[] = trim($cap, '" '); + } + } + + $script = new rcube_sieve_script($input, $caps); $result = $script->as_text(); $this->assertEquals(trim($result), trim($output), $message); |