From b2034fdfec040a67988e543a911208ef2491ce7a Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Sun, 22 Feb 2015 12:58:46 +0100 Subject: New RoundCube Plugins Git folder --- managesieve/tests/Parser.php | 62 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 managesieve/tests/Parser.php (limited to 'managesieve/tests/Parser.php') diff --git a/managesieve/tests/Parser.php b/managesieve/tests/Parser.php new file mode 100644 index 0000000..33edce0 --- /dev/null +++ b/managesieve/tests/Parser.php @@ -0,0 +1,62 @@ +as_text(); + + $this->assertEquals(trim($result), trim($output), $message); + } + + /** + * Data provider for test_parser() + */ + function data_parser() + { + $dir_path = realpath(__DIR__ . '/src'); + $dir = opendir($dir_path); + $result = array(); + + while ($file = readdir($dir)) { + if (preg_match('/^[a-z0-9_]+$/', $file)) { + $input = file_get_contents($dir_path . '/' . $file); + + if (file_exists($dir_path . '/' . $file . '.out')) { + $output = file_get_contents($dir_path . '/' . $file . '.out'); + } + else { + $output = $input; + } + + $result[] = array( + 'input' => $input, + 'output' => $output, + 'message' => "Error in parsing '$file' file", + ); + } + } + + return $result; + } +} -- cgit v1.2.3