mirror of
https://github.com/roundcube/roundcubemail.git
synced 2026-03-25 01:06:56 +01:00
Fixes composer dependencies: Package phpunit/phpunit-mock-objects is abandoned We cannot support v8 yet because of errors like: Declaration of MailFunc::setUp() must be compatible with PHPUnit\Framework\TestCase::setUp(): void It would require dropping PHP < 7.1 support.
36 lines
1.1 KiB
PHP
36 lines
1.1 KiB
PHP
<?php
|
|
|
|
class Tokenizer extends PHPUnit\Framework\TestCase
|
|
{
|
|
|
|
function setUp()
|
|
{
|
|
include_once __DIR__ . '/../lib/Roundcube/rcube_sieve_script.php';
|
|
}
|
|
|
|
function data_tokenizer()
|
|
{
|
|
return array(
|
|
array(1, "text: #test\nThis is test ; message;\nMulti line\n.\n;\n", '"This is test ; message;\nMulti line"'),
|
|
array(1, "text: #test\r\nThis is test ; message;\nMulti line\r\n.\r\n;", '"This is test ; message;\nMulti line"'),
|
|
array(0, '["test1","test2"]', '[["test1","test2"]]'),
|
|
array(1, '["test"]', '["test"]'),
|
|
array(1, '"te\\"st"', '"te\\"st"'),
|
|
array(0, 'test #comment', '["test"]'),
|
|
array(0, "text:\ntest\n.\ntext:\ntest\n.\n", '["test","test"]'),
|
|
array(0, "text:\r\ntest\r\n.\r\ntext:\r\ntest\r\n.\r\n", '["test","test"]'),
|
|
array(1, '"\\a\\\\\\"a"', '"a\\\\\\"a"'),
|
|
);
|
|
}
|
|
|
|
/**
|
|
* @dataProvider data_tokenizer
|
|
*/
|
|
function test_tokenizer($num, $input, $output)
|
|
{
|
|
$res = json_encode(rcube_sieve_script::tokenize($input, $num));
|
|
|
|
$this->assertEquals(trim($res), trim($output));
|
|
}
|
|
}
|