From 8c893b79d230cc844226bdf3b1de95cd5a99ecb2 Mon Sep 17 00:00:00 2001
From: Thomas Bruederli
Date: Thu, 30 Jan 2014 09:12:57 +0100
Subject: Branching off for release 1.0
---
tests/Framework/BaseReplacer.php | 34 ---
tests/Framework/Bootstrap.php | 218 -------------------
tests/Framework/Browser.php | 234 --------------------
tests/Framework/Cache.php | 20 --
tests/Framework/Charset.php | 180 ---------------
tests/Framework/ContentFilter.php | 20 --
tests/Framework/Csv2vcard.php | 58 -----
tests/Framework/Enriched.php | 74 -------
tests/Framework/Html.php | 45 ----
tests/Framework/Html2text.php | 78 -------
tests/Framework/Image.php | 20 --
tests/Framework/Imap.php | 20 --
tests/Framework/ImapGeneric.php | 61 ------
tests/Framework/MessageHeader.php | 20 --
tests/Framework/MessagePart.php | 20 --
tests/Framework/Mime.php | 213 ------------------
tests/Framework/Rcube.php | 20 --
tests/Framework/ResultIndex.php | 67 ------
tests/Framework/ResultSet.php | 20 --
tests/Framework/ResultThread.php | 59 -----
tests/Framework/Smtp.php | 20 --
tests/Framework/Spellchecker.php | 20 --
tests/Framework/StringReplacer.php | 75 -------
tests/Framework/User.php | 20 --
tests/Framework/Utils.php | 337 -----------------------------
tests/Framework/VCard.php | 119 ----------
tests/Framework/Washtml.php | 127 -----------
tests/MailFunc.php | 268 -----------------------
tests/Selenium/Addressbook/Addressbook.php | 21 --
tests/Selenium/Addressbook/Import.php | 29 ---
tests/Selenium/Login.php | 21 --
tests/Selenium/Logout.php | 20 --
tests/Selenium/Mail/CheckRecent.php | 14 --
tests/Selenium/Mail/Compose.php | 25 ---
tests/Selenium/Mail/Getunread.php | 13 --
tests/Selenium/Mail/List.php | 25 ---
tests/Selenium/Mail/Mail.php | 23 --
tests/Selenium/Settings/About.php | 14 --
tests/Selenium/Settings/Folders.php | 20 --
tests/Selenium/Settings/Identities.php | 19 --
tests/Selenium/Settings/Settings.php | 17 --
tests/Selenium/bootstrap.php | 185 ----------------
tests/Selenium/index.html | 8 -
tests/Selenium/phpunit.xml | 21 --
tests/bootstrap.php | 41 ----
tests/phpunit.xml | 70 ------
tests/src/BID-26800.txt | 53 -----
tests/src/Csv2vcard/email.csv | 5 -
tests/src/Csv2vcard/email.vcf | 20 --
tests/src/Csv2vcard/tb_plain.csv | 2 -
tests/src/Csv2vcard/tb_plain.vcf | 20 --
tests/src/apple.vcf | 49 -----
tests/src/format-flowed-unfolded.txt | 19 --
tests/src/format-flowed.txt | 21 --
tests/src/htmlbase.txt | 12 -
tests/src/htmlbody.txt | 51 -----
tests/src/htmlcom.txt | 16 --
tests/src/htmlxss.txt | 22 --
tests/src/imap_thread.txt | 1 -
tests/src/invalidchars.html | 1 -
tests/src/johndoe.vcf | 12 -
tests/src/mailto.txt | 8 -
tests/src/media.css | 22 --
tests/src/photo.vcf | 45 ----
tests/src/plainbody.txt | 38 ----
tests/src/thebat.vcf | 8 -
tests/src/utf-16_sample.vcf | Bin 460 -> 0 bytes
tests/src/valid.css | 30 ---
68 files changed, 3508 deletions(-)
delete mode 100644 tests/Framework/BaseReplacer.php
delete mode 100644 tests/Framework/Bootstrap.php
delete mode 100644 tests/Framework/Browser.php
delete mode 100644 tests/Framework/Cache.php
delete mode 100644 tests/Framework/Charset.php
delete mode 100644 tests/Framework/ContentFilter.php
delete mode 100644 tests/Framework/Csv2vcard.php
delete mode 100644 tests/Framework/Enriched.php
delete mode 100644 tests/Framework/Html.php
delete mode 100644 tests/Framework/Html2text.php
delete mode 100644 tests/Framework/Image.php
delete mode 100644 tests/Framework/Imap.php
delete mode 100644 tests/Framework/ImapGeneric.php
delete mode 100644 tests/Framework/MessageHeader.php
delete mode 100644 tests/Framework/MessagePart.php
delete mode 100644 tests/Framework/Mime.php
delete mode 100644 tests/Framework/Rcube.php
delete mode 100644 tests/Framework/ResultIndex.php
delete mode 100644 tests/Framework/ResultSet.php
delete mode 100644 tests/Framework/ResultThread.php
delete mode 100644 tests/Framework/Smtp.php
delete mode 100644 tests/Framework/Spellchecker.php
delete mode 100644 tests/Framework/StringReplacer.php
delete mode 100644 tests/Framework/User.php
delete mode 100644 tests/Framework/Utils.php
delete mode 100644 tests/Framework/VCard.php
delete mode 100644 tests/Framework/Washtml.php
delete mode 100644 tests/MailFunc.php
delete mode 100644 tests/Selenium/Addressbook/Addressbook.php
delete mode 100644 tests/Selenium/Addressbook/Import.php
delete mode 100644 tests/Selenium/Login.php
delete mode 100644 tests/Selenium/Logout.php
delete mode 100644 tests/Selenium/Mail/CheckRecent.php
delete mode 100644 tests/Selenium/Mail/Compose.php
delete mode 100644 tests/Selenium/Mail/Getunread.php
delete mode 100644 tests/Selenium/Mail/List.php
delete mode 100644 tests/Selenium/Mail/Mail.php
delete mode 100644 tests/Selenium/Settings/About.php
delete mode 100644 tests/Selenium/Settings/Folders.php
delete mode 100644 tests/Selenium/Settings/Identities.php
delete mode 100644 tests/Selenium/Settings/Settings.php
delete mode 100644 tests/Selenium/bootstrap.php
delete mode 100644 tests/Selenium/index.html
delete mode 100644 tests/Selenium/phpunit.xml
delete mode 100644 tests/bootstrap.php
delete mode 100644 tests/phpunit.xml
delete mode 100644 tests/src/BID-26800.txt
delete mode 100644 tests/src/Csv2vcard/email.csv
delete mode 100644 tests/src/Csv2vcard/email.vcf
delete mode 100644 tests/src/Csv2vcard/tb_plain.csv
delete mode 100644 tests/src/Csv2vcard/tb_plain.vcf
delete mode 100644 tests/src/apple.vcf
delete mode 100644 tests/src/format-flowed-unfolded.txt
delete mode 100644 tests/src/format-flowed.txt
delete mode 100644 tests/src/htmlbase.txt
delete mode 100644 tests/src/htmlbody.txt
delete mode 100644 tests/src/htmlcom.txt
delete mode 100644 tests/src/htmlxss.txt
delete mode 100644 tests/src/imap_thread.txt
delete mode 100644 tests/src/invalidchars.html
delete mode 100644 tests/src/johndoe.vcf
delete mode 100644 tests/src/mailto.txt
delete mode 100644 tests/src/media.css
delete mode 100644 tests/src/photo.vcf
delete mode 100644 tests/src/plainbody.txt
delete mode 100644 tests/src/thebat.vcf
delete mode 100755 tests/src/utf-16_sample.vcf
delete mode 100644 tests/src/valid.css
(limited to 'tests')
diff --git a/tests/Framework/BaseReplacer.php b/tests/Framework/BaseReplacer.php
deleted file mode 100644
index 44a9604ac..000000000
--- a/tests/Framework/BaseReplacer.php
+++ /dev/null
@@ -1,34 +0,0 @@
-assertInstanceOf('rcube_base_replacer', $object, "Class constructor");
- }
-
- /**
- * Test replace()
- */
- function test_replace()
- {
- $base = 'http://thisshouldntbetheurl.bob.com/';
- $html = 'Test URL';
-
- $replacer = new rcube_base_replacer($base);
- $response = $replacer->replace($html);
-
- $this->assertSame('Test URL', $response);
- }
-}
diff --git a/tests/Framework/Bootstrap.php b/tests/Framework/Bootstrap.php
deleted file mode 100644
index 904be7e3b..000000000
--- a/tests/Framework/Bootstrap.php
+++ /dev/null
@@ -1,218 +0,0 @@
-assertTrue($result, $title);
-
- $result = in_array_nocase($needle, null);
-
- $this->assertFalse($result, $title);
- }
-
- /**
- * bootstrap.php: parse_bytes()
- */
- function test_parse_bytes()
- {
- $data = array(
- '1' => 1,
- '1024' => 1024,
- '2k' => 2 * 1024,
- '2 k' => 2 * 1024,
- '2kb' => 2 * 1024,
- '2kB' => 2 * 1024,
- '2m' => 2 * 1048576,
- '2 m' => 2 * 1048576,
- '2mb' => 2 * 1048576,
- '2mB' => 2 * 1048576,
- '2g' => 2 * 1024 * 1048576,
- '2 g' => 2 * 1024 * 1048576,
- '2gb' => 2 * 1024 * 1048576,
- '2gB' => 2 * 1024 * 1048576,
- );
-
- foreach ($data as $value => $expected) {
- $result = parse_bytes($value);
- $this->assertEquals($expected, $result, "Invalid parse_bytes() result for $value");
- }
- }
-
- /**
- * bootstrap.php: slashify()
- */
- function test_slashify()
- {
- $data = array(
- 'test' => 'test/',
- 'test/' => 'test/',
- '' => '/',
- "\\" => "\\/",
- );
-
- foreach ($data as $value => $expected) {
- $result = slashify($value);
- $this->assertEquals($expected, $result, "Invalid slashify() result for $value");
- }
-
- }
-
- /**
- * bootstrap.php: unslashify()
- */
- function test_unslashify()
- {
- $data = array(
- 'test' => 'test',
- 'test/' => 'test',
- '/' => '',
- "\\/" => "\\",
- 'test/test' => 'test/test',
- 'test//' => 'test',
- );
-
- foreach ($data as $value => $expected) {
- $result = unslashify($value);
- $this->assertEquals($expected, $result, "Invalid unslashify() result for $value");
- }
-
- }
-
- /**
- * bootstrap.php: get_offset_sec()
- */
- function test_get_offset_sec()
- {
- $data = array(
- '1s' => 1,
- '1m' => 1 * 60,
- '1h' => 1 * 60 * 60,
- '1d' => 1 * 60 * 60 * 24,
- '1w' => 1 * 60 * 60 * 24 * 7,
- '1y' => (int) '1y',
- 100 => 100,
- '100' => 100,
- );
-
- foreach ($data as $value => $expected) {
- $result = get_offset_sec($value);
- $this->assertEquals($expected, $result, "Invalid get_offset_sec() result for $value");
- }
-
- }
-
- /**
- * bootstrap.php: array_keys_recursive()
- */
- function test_array_keys_recursive()
- {
- $input = array(
- 'one' => array(
- 'two' => array(
- 'three' => array(),
- 'four' => 'something',
- ),
- ),
- 'five' => 'test',
- );
-
- $result = array_keys_recursive($input);
- $input_str = 'one,two,three,four,five';
- $result_str = implode(',', $result);
-
- $this->assertEquals($input_str, $result_str, "Invalid array_keys_recursive() result");
- }
-
- /**
- * bootstrap.php: format_email()
- */
- function test_format_email()
- {
- $data = array(
- '' => '',
- 'test' => 'test',
- 'test@test.tld' => 'test@test.tld',
- 'test@[127.0.0.1]' => 'test@[127.0.0.1]',
- 'TEST@TEST.TLD' => 'TEST@test.tld',
- );
-
- foreach ($data as $value => $expected) {
- $result = format_email($value);
- $this->assertEquals($expected, $result, "Invalid format_email() result for $value");
- }
-
- }
-
- /**
- * bootstrap.php: format_email_recipient()
- */
- function test_format_email_recipient()
- {
- $data = array(
- '' => array(''),
- 'test' => array('test'),
- 'test@test.tld' => array('test@test.tld'),
- 'test@[127.0.0.1]' => array('test@[127.0.0.1]'),
- 'TEST@TEST.TLD' => array('TEST@TEST.TLD'),
- 'TEST ' => array('test@test.tld', 'TEST'),
- '"TEST\"" ' => array('test@test.tld', 'TEST"'),
- );
-
- foreach ($data as $expected => $value) {
- $result = format_email_recipient($value[0], $value[1]);
- $this->assertEquals($expected, $result, "Invalid format_email_recipient()");
- }
-
- }
-
- /**
- * bootstrap.php: is_ascii()
- */
- function test_is_ascii()
- {
- $result = is_ascii("0123456789");
- $this->assertTrue($result, "Valid ASCII (numbers)");
-
- $result = is_ascii("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
- $this->assertTrue($result, "Valid ASCII (letters)");
-
- $result = is_ascii(" !\"#\$%&'()*+,-./:;<=>?@[\\^_`{|}~");
- $this->assertTrue($result, "Valid ASCII (special characters)");
-
- $result = is_ascii("\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F"
- ."\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F");
- $this->assertTrue($result, "Valid ASCII (control characters)");
-
- $result = is_ascii("\n", false);
- $this->assertFalse($result, "Valid ASCII (control characters)");
-
- $result = is_ascii("ż");
- $this->assertFalse($result, "Invalid ASCII (UTF-8 character)");
-
- $result = is_ascii("ż", false);
- $this->assertFalse($result, "Invalid ASCII (UTF-8 character [2])");
- }
-
- /**
- * bootstrap.php: version_parse()
- */
- function test_version_parse()
- {
- $this->assertEquals('0.9.0', version_parse('0.9-stable'));
- $this->assertEquals('0.9.99', version_parse('0.9-git'));
- }
-}
diff --git a/tests/Framework/Browser.php b/tests/Framework/Browser.php
deleted file mode 100644
index a042572a8..000000000
--- a/tests/Framework/Browser.php
+++ /dev/null
@@ -1,234 +0,0 @@
-assertInstanceOf('rcube_browser', $object, "Class constructor");
- }
-
- /**
- * @dataProvider browsers
- */
- function test_browser($useragent, $opera, $chrome, $ie, $ns, $safari, $mz)
- {
-
- $object = $this->getBrowser($useragent);
-
- $this->assertEquals($opera, $object->opera, 'Check for Opera failed');
- $this->assertEquals($chrome, $object->chrome, 'Check for Chrome failed');
- $this->assertEquals($ie, $object->ie, 'Check for IE failed');
- $this->assertEquals($ns, $object->ns, 'Check for NS failed');
- $this->assertEquals($safari, $object->safari, 'Check for Safari failed');
- $this->assertEquals($mz, $object->mz, 'Check for MZ failed');
- }
-
- /**
- * @dataProvider os
- */
- function test_os($useragent, $windows, $linux, $unix, $mac)
- {
- $object = $this->getBrowser($useragent);
-
- $this->assertEquals($windows, $object->win, 'Check Result of Windows');
- $this->assertEquals($linux, $object->linux, 'Check Result of Linux');
- $this->assertEquals($mac, $object->mac, 'Check Result of Mac');
- $this->assertEquals($unix, $object->unix, 'Check Result of Unix');
-
- }
-
- /**
- * @dataProvider versions
- */
- function test_version($useragent, $version)
- {
- $object = $this->getBrowser($useragent);
- $this->assertEquals($version, $object->ver);
- }
-
- /**
- * @dataProvider dom
- */
- function test_dom($useragent, $dom)
- {
- $object = $this->getBrowser($useragent);
- $this->assertEquals($dom, $object->dom);
-
- }
-
- /**
- * @dataProvider pngalpha
- */
- function test_pngalpha($useragent, $pngalpha)
- {
- $object = $this->getBrowser($useragent);
- $this->assertEquals($pngalpha, $object->pngalpha);
- }
-
- /**
- * @dataProvider imgdata
- */
- function test_imgdata($useragent, $imgdata)
- {
- $object = $this->getBrowser($useragent);
- $this->assertEquals($imgdata, $object->imgdata);
- }
-
- function versions()
- {
- return $this->extractDataSet(array('version'));
- }
-
- function pngalpha()
- {
- return $this->extractDataSet(array('canPNGALPHA'));
- }
-
- function imgdata()
- {
- return $this->extractDataSet(array('canIMGDATA'));
- }
-
- private function extractDataSet($keys)
- {
- $keys = array_merge(array('useragent'), $keys);
-
- $browser = $this->useragents();
-
- $extracted = array();
-
- foreach ($browser as $label => $data) {
- foreach($keys as $key) {
- $extracted[$data['useragent']][] = $data[$key];
- }
-
- }
-
- return $extracted;
- }
-
- function lang()
- {
- return $this->extractDataSet(array('lang'));
- }
-
- function dom()
- {
- return $this->extractDataSet(array('hasDOM'));
- }
-
- function browsers()
- {
- return $this->extractDataSet(array('isOpera','isChrome','isIE','isNS','isSafari','isMZ'));
- }
-
- function useragents()
- {
- return array(
- 'WIN: Mozilla Firefox ' => array(
- 'useragent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1',
- 'version' => '1.8', //Version
- 'isWin' => true, //isWindows
- 'isLinux' => false,
- 'isMac' => false, //isMac
- 'isUnix' => false, //isUnix
- 'isOpera' => false, //isOpera
- 'isChrome' => false, //isChrome
- 'isIE' => false, //isIE
- 'isNS' => false, //isNS
- 'isSafari' => false, //isSafari
- 'isMZ' => true, //isMZ
- 'lang' => 'en-US', //lang
- 'hasDOM' => true, //hasDOM
- 'canPNGALPHA' => true, //canPNGALPHA
- 'canIMGDATA' => true, //canIMGDATA
- ),
- 'LINUX: Bon Echo ' => array(
- 'useragent' => 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.1) Gecko/20070222 BonEcho/2.0.0.1',
- 'version' => '1.8', //Version
- 'isWin' => false, //isWindows
- 'isLinux' => true,
- 'isMac' => false, //isMac
- 'isUnix' => false, //isUnix
- 'isOpera' => false, //isOpera
- 'isChrome' => false, //isChrome
- 'isIE' => false, //isIE
- 'isNS' => false, //isNS
- 'isSafari' => false, //isSafari
- 'isMZ' => true, //isMZ
- 'lang' => 'en-US', //lang
- 'hasDOM' => true, //hasDOM
- 'canPNGALPHA' => true, //canPNGALPHA
- 'canIMGDATA' => true, //canIMGDATA
- ),
-
- 'Chrome Mac' => array(
- 'useragent' => 'Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-US) AppleWebKit/534.3 (KHTML, like Gecko) Chrome/6.0.461.0 Safari/534.3',
- 'version' => '6', //Version
- 'isWin' => false, //isWindows
- 'isLinux' => false,
- 'isMac' => true, //isMac
- 'isUnix' => false, //isUnix
- 'isOpera' => false, //isOpera
- 'isChrome' => true, //isChrome
- 'isIE' => false, //isIE
- 'isNS' => false, //isNS
- 'isSafari' => false, //isSafari
- 'isMZ' => false, //isMZ
- 'lang' => 'en-US', //lang
- 'hasDOM' => false, //hasDOM
- 'canPNGALPHA' => false, //canPNGALPHA
- 'canIMGDATA' => true, //canIMGDATA
- ),
-
- 'IE 11' => array(
- 'useragent' => 'Mozilla/5.0 (Windows NT 6.3; Trident/7.0; .NET4.0E; .NET4.0C; rv:11.0) like Gecko',
- 'version' => '11.0', //Version
- 'isWin' => true, //isWindows
- 'isLinux' => false,
- 'isMac' => false, //isMac
- 'isUnix' => false, //isUnix
- 'isOpera' => false, //isOpera
- 'isChrome' => false, //isChrome
- 'isIE' => true, //isIE
- 'isNS' => false, //isNS
- 'isSafari' => false, //isSafari
- 'isMZ' => false, //isMZ
- 'lang' => '', //lang
- 'hasDOM' => true, //hasDOM
- 'canPNGALPHA' => true, //canPNGALPHA
- 'canIMGDATA' => false, //canIMGDATA
- ),
- );
- }
-
- function os()
- {
- return $this->extractDataSet(array('isWin','isLinux','isUnix','isMac'));
- }
-
- /**
- * @param string $useragent
- * @return rcube_browser
- */
- private function getBrowser($useragent)
- {
- /** @var $object rcube_browser */
- $_SERVER['HTTP_USER_AGENT'] = $useragent;
-
- $object = new rcube_browser();
-
- return $object;
- }
-}
diff --git a/tests/Framework/Cache.php b/tests/Framework/Cache.php
deleted file mode 100644
index dc026a634..000000000
--- a/tests/Framework/Cache.php
+++ /dev/null
@@ -1,20 +0,0 @@
-assertInstanceOf('rcube_cache', $object, "Class constructor");
- }
-}
diff --git a/tests/Framework/Charset.php b/tests/Framework/Charset.php
deleted file mode 100644
index d3d3e88dd..000000000
--- a/tests/Framework/Charset.php
+++ /dev/null
@@ -1,180 +0,0 @@
-assertEquals($output, rcube_charset::clean($input));
- }
-
- /**
- * Data for test_parse_charset()
- */
- function data_parse_charset()
- {
- return array(
- array('UTF8', 'UTF-8'),
- array('WIN1250', 'WINDOWS-1250'),
- );
- }
-
- /**
- * @dataProvider data_parse_charset
- */
- function test_parse_charset($input, $output)
- {
- $this->assertEquals($output, rcube_charset::parse_charset($input));
- }
-
- /**
- * Data for test_convert()
- */
- function data_convert()
- {
- return array(
- array('ö', 'ö', 'UTF-8', 'UTF-8'),
- array('ö', '', 'UTF-8', 'US-ASCII'),
- array('aż', 'a', 'UTF-8', 'US-ASCII'),
- array('&BCAEMARBBEEESwQ7BDoEOA-', 'Рассылки', 'UTF7-IMAP', 'UTF-8'),
- array('Рассылки', '&BCAEMARBBEEESwQ7BDoEOA-', 'UTF-8', 'UTF7-IMAP'),
- );
- }
-
- /**
- * @dataProvider data_convert
- */
- function test_convert($input, $output, $from, $to)
- {
- $this->assertEquals($output, rcube_charset::convert($input, $from, $to));
- }
-
- /**
- * Data for test_utf7_to_utf8()
- */
- function data_utf7_to_utf8()
- {
- return array(
- array('+BCAEMARBBEEESwQ7BDoEOA-', 'Рассылки'),
- );
- }
-
- /**
- * @dataProvider data_utf7_to_utf8
- */
- function test_utf7_to_utf8($input, $output)
- {
- $this->assertEquals($output, rcube_charset::utf7_to_utf8($input));
- }
-
- /**
- * Data for test_utf7imap_to_utf8()
- */
- function data_utf7imap_to_utf8()
- {
- return array(
- array('&BCAEMARBBEEESwQ7BDoEOA-', 'Рассылки'),
- );
- }
-
- /**
- * @dataProvider data_utf7imap_to_utf8
- */
- function test_utf7imap_to_utf8($input, $output)
- {
- $this->assertEquals($output, rcube_charset::utf7imap_to_utf8($input));
- }
-
- /**
- * Data for test_utf8_to_utf7imap()
- */
- function data_utf8_to_utf7imap()
- {
- return array(
- array('Рассылки', '&BCAEMARBBEEESwQ7BDoEOA-'),
- );
- }
-
- /**
- * @dataProvider data_utf8_to_utf7imap
- */
- function test_utf8_to_utf7imap($input, $output)
- {
- $this->assertEquals($output, rcube_charset::utf8_to_utf7imap($input));
- }
-
- /**
- * Data for test_utf16_to_utf8()
- */
- function data_utf16_to_utf8()
- {
- return array(
- array(base64_decode('BCAEMARBBEEESwQ7BDoEOA=='), 'Рассылки'),
- );
- }
-
- /**
- * @dataProvider data_utf16_to_utf8
- */
- function test_utf16_to_utf8($input, $output)
- {
- $this->assertEquals($output, rcube_charset::utf16_to_utf8($input));
- }
-
- /**
- * Data for test_detect()
- */
- function data_detect()
- {
- return array(
- array('', '', 'UTF-8'),
- array('a', 'UTF-8', 'UTF-8'),
- );
- }
-
- /**
- * @dataProvider data_detect
- */
- function test_detect($input, $fallback, $output)
- {
- $this->assertEquals($output, rcube_charset::detect($input, $fallback));
- }
-
- /**
- * Data for test_detect()
- */
- function data_detect_with_lang()
- {
- return array(
- array('ܦW,Dn', 'zh_TW', 'BIG-5'),
- );
- }
-
- /**
- * @dataProvider data_detect_with_lang
- */
- function test_detect_with_lang($input, $lang, $output)
- {
- $this->assertEquals($output, rcube_charset::detect($input, $output, $lang));
- }
-
-}
diff --git a/tests/Framework/ContentFilter.php b/tests/Framework/ContentFilter.php
deleted file mode 100644
index 9bee9368b..000000000
--- a/tests/Framework/ContentFilter.php
+++ /dev/null
@@ -1,20 +0,0 @@
-assertInstanceOf('rcube_content_filter', $object, "Class constructor");
- }
-}
diff --git a/tests/Framework/Csv2vcard.php b/tests/Framework/Csv2vcard.php
deleted file mode 100644
index 5d52efc58..000000000
--- a/tests/Framework/Csv2vcard.php
+++ /dev/null
@@ -1,58 +0,0 @@
-import('');
- $this->assertSame(array(), $csv->export());
- }
-
- function test_import_tb_plain()
- {
- $csv_text = file_get_contents(TESTS_DIR . '/src/Csv2vcard/tb_plain.csv');
- $vcf_text = file_get_contents(TESTS_DIR . '/src/Csv2vcard/tb_plain.vcf');
-
- $csv = new rcube_csv2vcard;
- $csv->import($csv_text);
- $result = $csv->export();
- $vcard = $result[0]->export(false);
-
- $this->assertCount(1, $result);
-
- $vcf_text = trim(str_replace("\r\n", "\n", $vcf_text));
- $vcard = trim(str_replace("\r\n", "\n", $vcard));
-
- $this->assertEquals($vcf_text, $vcard);
- }
-
- function test_import_email()
- {
- $csv_text = file_get_contents(TESTS_DIR . '/src/Csv2vcard/email.csv');
- $vcf_text = file_get_contents(TESTS_DIR . '/src/Csv2vcard/email.vcf');
-
- $csv = new rcube_csv2vcard;
- $csv->import($csv_text);
- $result = $csv->export();
-
- $this->assertCount(4, $result);
-
- $vcard = '';
- foreach ($result as $vcf) {
- $vcard .= $vcf->export(false) . "\n";
- }
-
- $vcf_text = trim(str_replace("\r\n", "\n", $vcf_text));
- $vcard = trim(str_replace("\r\n", "\n", $vcard));
- $this->assertEquals($vcf_text, $vcard);
- }
-}
diff --git a/tests/Framework/Enriched.php b/tests/Framework/Enriched.php
deleted file mode 100644
index 26bbc3b4e..000000000
--- a/tests/Framework/Enriched.php
+++ /dev/null
@@ -1,74 +0,0 @@
-assertInstanceOf('rcube_enriched', $object, "Class constructor");
- }
-
- /**
- * Test to_html()
- */
- function test_to_html()
- {
- $enriched = 'the-text';
- $expected = 'the-text';
- $result = rcube_enriched::to_html($enriched);
-
- $this->assertSame($expected, $result);
- }
-
- /**
- * Data for test_formatting()
- */
- function data_formatting()
- {
- return array(
- array('', ''),
- array('', ''),
- array('', ''),
- array('', ''),
- array('', ''),
- array('', ''),
- array('', ''),
- array('', ''),
- array('', ''),
- array('', ''),
- array('', ''),
- array('', ''),
- array('', ''),
- array('', ''),
- array('', ''),
- array('', ''),
- array('', ''),
- array('', ''),
- array('', ''),
- array('', ''),
- array('', ''),
- array('', ''),
- );
- }
-
- /**
- * Test formatting conversion
- * @dataProvider data_formatting
- */
- function test_formatting($enriched, $expected)
- {
- $result = rcube_enriched::to_html($enriched);
-
- $this->assertSame($expected, $result);
- }
-}
diff --git a/tests/Framework/Html.php b/tests/Framework/Html.php
deleted file mode 100644
index 60284deef..000000000
--- a/tests/Framework/Html.php
+++ /dev/null
@@ -1,45 +0,0 @@
-assertInstanceOf('html', $object, "Class constructor");
- }
-
- /**
- * Data for test_quote()
- */
- function data_quote()
- {
- return array(
- array('abc', 'abc'),
- array('?', '?'),
- array('"', '"'),
- array('<', '<'),
- array('>', '>'),
- array('&', '&'),
- array('&', '&'),
- );
- }
-
- /**
- * Test for quote()
- * @dataProvider data_quote
- */
- function test_quote($str, $result)
- {
- $this->assertEquals(html::quote($str), $result);
- }
-}
diff --git a/tests/Framework/Html2text.php b/tests/Framework/Html2text.php
deleted file mode 100644
index 3e0df48d9..000000000
--- a/tests/Framework/Html2text.php
+++ /dev/null
@@ -1,78 +0,0 @@
- array(
- 'title' => 'Test entry',
- 'in' => '',
- 'out' => '',
- ),
- 1 => array(
- 'title' => 'Basic HTML entities',
- 'in' => '"&',
- 'out' => '"&',
- ),
- 2 => array(
- 'title' => 'HTML entity string',
- 'in' => '"',
- 'out' => '"',
- ),
- 3 => array(
- 'title' => 'HTML entity in STRONG tag',
- 'in' => 'ś', // ś
- 'out' => 'Ś', // upper ś
- ),
- 4 => array(
- 'title' => 'STRONG tag to upper-case conversion',
- 'in' => 'ś',
- 'out' => 'Ś',
- ),
- 5 => array(
- 'title' => 'STRONG inside B tag',
- 'in' => 'ś',
- 'out' => 'Ś',
- ),
- );
- }
-
- /**
- * @dataProvider data_html2text
- */
- function test_html2text($title, $in, $out)
- {
- $ht = new rcube_html2text(null, false, false);
-
- $ht->set_html($in);
- $res = $ht->get_text();
-
- $this->assertEquals($out, $res, $title);
- }
-
- /**
- *
- */
- function test_multiple_blockquotes()
- {
- $html = <<Begin
OUTER BEGININNER 1
Par 1
-INNER 2
Par 2
-
Par 3
-INNER 3
OUTER END
-EOF;
- $ht = new rcube_html2text($html, false, false);
- $res = $ht->get_text();
-
- $this->assertContains('>> INNER 1', $res, 'Quote inner');
- $this->assertContains('>> INNER 3', $res, 'Quote inner');
- $this->assertContains('> OUTER END', $res, 'Quote outer');
- }
-}
diff --git a/tests/Framework/Image.php b/tests/Framework/Image.php
deleted file mode 100644
index 31e852042..000000000
--- a/tests/Framework/Image.php
+++ /dev/null
@@ -1,20 +0,0 @@
-assertInstanceOf('rcube_image', $object, "Class constructor");
- }
-}
diff --git a/tests/Framework/Imap.php b/tests/Framework/Imap.php
deleted file mode 100644
index 3f52e07be..000000000
--- a/tests/Framework/Imap.php
+++ /dev/null
@@ -1,20 +0,0 @@
-assertInstanceOf('rcube_imap', $object, "Class constructor");
- }
-}
diff --git a/tests/Framework/ImapGeneric.php b/tests/Framework/ImapGeneric.php
deleted file mode 100644
index af73158e5..000000000
--- a/tests/Framework/ImapGeneric.php
+++ /dev/null
@@ -1,61 +0,0 @@
-assertInstanceOf('rcube_imap_generic', $object, "Class constructor");
- }
-
- /**
- * Test for uncompressMessageSet
- */
- function test_uncompressMessageSet()
- {
- $result = rcube_imap_generic::uncompressMessageSet(null);
- $this->assertSame(array(), $result);
- $this->assertCount(0, $result);
-
- $result = rcube_imap_generic::uncompressMessageSet('1');
- $this->assertSame(array(1), $result);
- $this->assertCount(1, $result);
-
- $result = rcube_imap_generic::uncompressMessageSet('1:3');
- $this->assertSame(array(1, 2, 3), $result);
- $this->assertCount(3, $result);
- }
-
- /**
- * Test for tokenizeResponse
- */
- function test_tokenizeResponse()
- {
- $response = "test brack[et] {1}\r\na {0}\r\n (item1 item2)";
-
- $result = rcube_imap_generic::tokenizeResponse($response, 1);
- $this->assertSame("test", $result);
-
- $result = rcube_imap_generic::tokenizeResponse($response, 1);
- $this->assertSame("brack[et]", $result);
-
- $result = rcube_imap_generic::tokenizeResponse($response, 1);
- $this->assertSame("a", $result);
-
- $result = rcube_imap_generic::tokenizeResponse($response, 1);
- $this->assertSame("", $result);
-
- $result = rcube_imap_generic::tokenizeResponse($response, 1);
- $this->assertSame(array('item1', 'item2'), $result);
- }
-}
diff --git a/tests/Framework/MessageHeader.php b/tests/Framework/MessageHeader.php
deleted file mode 100644
index e5bc1752f..000000000
--- a/tests/Framework/MessageHeader.php
+++ /dev/null
@@ -1,20 +0,0 @@
-assertInstanceOf('rcube_message_header', $object, "Class constructor");
- }
-}
diff --git a/tests/Framework/MessagePart.php b/tests/Framework/MessagePart.php
deleted file mode 100644
index deb426024..000000000
--- a/tests/Framework/MessagePart.php
+++ /dev/null
@@ -1,20 +0,0 @@
-assertInstanceOf('rcube_message_part', $object, "Class constructor");
- }
-}
diff --git a/tests/Framework/Mime.php b/tests/Framework/Mime.php
deleted file mode 100644
index d767905e3..000000000
--- a/tests/Framework/Mime.php
+++ /dev/null
@@ -1,213 +0,0 @@
- 'test@domain.tld',
- 1 => '',
- 2 => 'Test ',
- 3 => 'Test Test ',
- 4 => 'Test Test',
- 5 => '"Test Test" ',
- 6 => '"Test Test"',
- 7 => '"Test \\" Test" ',
- 8 => '"Test',
- 9 => '=?ISO-8859-1?B?VGVzdAo=?= ',
- 10 => '=?ISO-8859-1?B?VGVzdAo=?=', // #1487068
- // comments in address (#1487673)
- 11 => 'Test (comment) ',
- 12 => '"Test" (comment) ',
- 13 => '"Test (comment)" (comment) ',
- 14 => '(comment) ',
- 15 => 'Test ',
- 16 => 'Test Test ((comment)) ',
- 17 => 'test@domain.tld (comment)',
- 18 => '"Test,Test" ',
- // 1487939
- 19 => 'Test <"test test"@domain.tld>',
- 20 => '<"test test"@domain.tld>',
- 21 => '"test test"@domain.tld',
- // invalid (#1489092)
- 22 => '"John Doe @ SomeBusinessName" ',
- 23 => '=?UTF-8?B?IlRlc3QsVGVzdCI=?= ',
- );
-
- $results = array(
- 0 => array(1, '', 'test@domain.tld'),
- 1 => array(1, '', 'test@domain.tld'),
- 2 => array(1, 'Test', 'test@domain.tld'),
- 3 => array(1, 'Test Test', 'test@domain.tld'),
- 4 => array(1, 'Test Test', 'test@domain.tld'),
- 5 => array(1, 'Test Test', 'test@domain.tld'),
- 6 => array(1, 'Test Test', 'test@domain.tld'),
- 7 => array(1, 'Test " Test', 'test@domain.tld'),
- 8 => array(1, 'Test array(1, 'Test', 'test@domain.tld'),
- 10 => array(1, 'Test', 'test@domain.tld'),
- 11 => array(1, 'Test', 'test@domain.tld'),
- 12 => array(1, 'Test', 'test@domain.tld'),
- 13 => array(1, 'Test (comment)', 'test@domain.tld'),
- 14 => array(1, '', 'test@domain.tld'),
- 15 => array(1, 'Test', 'test@domain.tld'),
- 16 => array(1, 'Test Test', 'test@domain.tld'),
- 17 => array(1, '', 'test@domain.tld'),
- 18 => array(1, 'Test,Test', 'test@domain.tld'),
- 19 => array(1, 'Test', '"test test"@domain.tld'),
- 20 => array(1, '', '"test test"@domain.tld'),
- 21 => array(1, '', '"test test"@domain.tld'),
- // invalid (#1489092)
- 22 => array(1, 'John Doe @ SomeBusinessName', 'MAILER-DAEMON'),
- 23 => array(1, 'Test,Test', 'test@domain.tld'),
- );
-
- foreach ($headers as $idx => $header) {
- $res = rcube_mime::decode_address_list($header);
-
- $this->assertEquals($results[$idx][0], count($res), "Rows number in result for header: " . $header);
- $this->assertEquals($results[$idx][1], $res[1]['name'], "Name part decoding for header: " . $header);
- $this->assertEquals($results[$idx][2], $res[1]['mailto'], "Email part decoding for header: " . $header);
- }
- }
-
- /**
- * Test decoding of header values
- * Uses rcube_mime::decode_mime_string()
- */
- function test_header_decode_qp()
- {
- $test = array(
- // #1488232: invalid character "?"
- 'quoted-printable (1)' => array(
- 'in' => '=?utf-8?Q?Certifica=C3=A7=C3=A3??=',
- 'out' => 'Certifica=C3=A7=C3=A3?',
- ),
- 'quoted-printable (2)' => array(
- 'in' => '=?utf-8?Q?Certifica=?= =?utf-8?Q?C3=A7=C3=A3?=',
- 'out' => 'Certifica=C3=A7=C3=A3',
- ),
- 'quoted-printable (3)' => array(
- 'in' => '=?utf-8?Q??= =?utf-8?Q??=',
- 'out' => '',
- ),
- 'quoted-printable (4)' => array(
- 'in' => '=?utf-8?Q??= a =?utf-8?Q??=',
- 'out' => ' a ',
- ),
- 'quoted-printable (5)' => array(
- 'in' => '=?utf-8?Q?a?= =?utf-8?Q?b?=',
- 'out' => 'ab',
- ),
- 'quoted-printable (6)' => array(
- 'in' => '=?utf-8?Q? ?= =?utf-8?Q?a?=',
- 'out' => ' a',
- ),
- 'quoted-printable (7)' => array(
- 'in' => '=?utf-8?Q?___?= =?utf-8?Q?a?=',
- 'out' => ' a',
- ),
- );
-
- foreach ($test as $idx => $item) {
- $res = rcube_mime::decode_mime_string($item['in'], 'UTF-8');
- $res = quoted_printable_encode($res);
-
- $this->assertEquals($item['out'], $res, "Header decoding for: " . $idx);
- }
- }
-
- /**
- * Test format=flowed unfolding
- */
- function test_format_flowed()
- {
- $raw = file_get_contents(TESTS_DIR . 'src/format-flowed-unfolded.txt');
- $flowed = file_get_contents(TESTS_DIR . 'src/format-flowed.txt');
-
- $this->assertEquals($flowed, rcube_mime::format_flowed($raw, 80), "Test correct folding and space-stuffing");
- }
-
- /**
- * Test format=flowed unfolding
- */
- function test_unfold_flowed()
- {
- $flowed = file_get_contents(TESTS_DIR . 'src/format-flowed.txt');
- $unfolded = file_get_contents(TESTS_DIR . 'src/format-flowed-unfolded.txt');
-
- $this->assertEquals($unfolded, rcube_mime::unfold_flowed($flowed), "Test correct unfolding of quoted lines");
- }
-
- /**
- * Test wordwrap()
- */
- function test_wordwrap()
- {
- $samples = array(
- array(
- array("aaaa aaaa\n aaaa"),
- "aaaa aaaa\n aaaa",
- ),
- array(
- array("123456789 123456789 123456789 123", 29),
- "123456789 123456789 123456789\n123",
- ),
- array(
- array("123456789 3456789 123456789", 29),
- "123456789 3456789 123456789",
- ),
- array(
- array("123456789 123456789 123456789 123", 29),
- "123456789 123456789 123456789\n 123",
- ),
- array(
- array("abc", 1, "\n", true),
- "a\nb\nc",
- ),
- array(
- array("ąść", 1, "\n", true, 'UTF-8'),
- "ą\nś\nć",
- ),
- array(
- array(">abc\n>def", 2, "\n", true),
- ">abc\n>def",
- ),
- array(
- array("abc def", 3, "-"),
- "abc-def",
- ),
- array(
- array("----------------------------------------------------------------------------------------\nabc def123456789012345", 76),
- "----------------------------------------------------------------------------------------\nabc def123456789012345",
- ),
- array(
- array("-------\nabc def", 5),
- "-------\nabc\ndef",
- ),
- array(
- array("http://xx.xxx.xx.xxx:8080/addressbooks/roundcubexxxxx%40xxxxxxxxxxxxxxxxxxxxxxx.xx.xx/testing/", 70),
- "http://xx.xxx.xx.xxx:8080/addressbooks/roundcubexxxxx%40xxxxxxxxxxxxxxxxxxxxxxx.xx.xx/testing/",
- ),
- array(
- array("this-is-just-some-blabla-to-make-this-more-than-seventy-five-characters-in-a-row -- this line should be wrapped", 20, "\n"),
- "this-is-just-some-blabla-to-make-this-more-than-seventy-five-characters-in-a-row\n-- this line should\nbe wrapped",
- ),
- );
-
- foreach ($samples as $sample) {
- $this->assertEquals($sample[1], call_user_func_array(array('rcube_mime', 'wordwrap'), $sample[0]), "Test text wrapping");
- }
- }
-
-}
diff --git a/tests/Framework/Rcube.php b/tests/Framework/Rcube.php
deleted file mode 100644
index 637558dc9..000000000
--- a/tests/Framework/Rcube.php
+++ /dev/null
@@ -1,20 +0,0 @@
-assertInstanceOf('rcube', $object, "Class singleton");
- }
-}
diff --git a/tests/Framework/ResultIndex.php b/tests/Framework/ResultIndex.php
deleted file mode 100644
index da1cc628f..000000000
--- a/tests/Framework/ResultIndex.php
+++ /dev/null
@@ -1,67 +0,0 @@
-assertInstanceOf('rcube_result_index', $object, "Class constructor");
- }
-
- /**
- * thread parser test
- */
- function test_parse()
- {
- $text = "* SORT 2001 2002 2035 2036 2037 2038 2044 2046 2043 2045 2226 2225 2224 2223";
- $object = new rcube_result_index('INBOX', $text);
-
- $this->assertSame(false, $object->is_empty(), "Object is empty");
- $this->assertSame(false, $object->is_error(), "Object is error");
- $this->assertSame(2226, $object->max(), "Max message UID");
- $this->assertSame(2001, $object->min(), "Min message UID");
- $this->assertSame(14, $object->count_messages(), "Messages count");
- $this->assertSame(14, $object->count(), "Messages count");
- $this->assertSame(1, $object->exists(2002, true), "Message exists");
- $this->assertSame(true, $object->exists(2002), "Message exists (bool)");
- $this->assertSame(2001, $object->get_element('FIRST'), "Get first element");
- $this->assertSame(2223, $object->get_element('LAST'), "Get last element");
- $this->assertSame(2035, (int) $object->get_element(2), "Get specified element");
- $this->assertSame("2001:2002,2035:2038,2043:2046,2223:2226", $object->get_compressed(), "Get compressed index");
- $this->assertSame('INBOX', $object->get_parameters('MAILBOX'), "Get parameter");
-
- $clone = clone $object;
- $clone->filter(array(2035, 2002));
-
- $this->assertSame(2, $clone->count(), "Messages count (filtered)");
- $this->assertSame(2002, $clone->get_element('FIRST'), "Get first element (filtered)");
-
- $clone = clone $object;
- $clone->revert();
-
- $this->assertSame(14, $clone->count(), "Messages count (reverted)");
- $this->assertSame(12, $clone->exists(2002, true), "Message exists (reverted)");
- $this->assertSame(true, $clone->exists(2002), "Message exists (bool) (reverted)");
- $this->assertSame(2223, $clone->get_element('FIRST'), "Get first element (reverted)");
- $this->assertSame(2001, $clone->get_element('LAST'), "Get last element (reverted)");
- $this->assertSame(2225, (int) $clone->get_element(2), "Get specified element (reverted)");
-
- $clone = clone $object;
- $clone->slice(2, 3);
-
- $this->assertSame(3, $clone->count(), "Messages count (sliced)");
- $this->assertSame(2035, $clone->get_element('FIRST'), "Get first element (sliced)");
- $this->assertSame(2037, $clone->get_element('LAST'), "Get last element (sliced)");
- }
-
-}
diff --git a/tests/Framework/ResultSet.php b/tests/Framework/ResultSet.php
deleted file mode 100644
index 2d04e53c0..000000000
--- a/tests/Framework/ResultSet.php
+++ /dev/null
@@ -1,20 +0,0 @@
-assertInstanceOf('rcube_result_set', $object, "Class constructor");
- }
-}
diff --git a/tests/Framework/ResultThread.php b/tests/Framework/ResultThread.php
deleted file mode 100644
index 55fca4c6a..000000000
--- a/tests/Framework/ResultThread.php
+++ /dev/null
@@ -1,59 +0,0 @@
-assertInstanceOf('rcube_result_thread', $object, "Class constructor");
- }
-
- /**
- * thread parser test
- */
- function test_parse_thread()
- {
- $text = file_get_contents(__DIR__ . '/../src/imap_thread.txt');
- $object = new rcube_result_thread('INBOX', $text);
-
- $this->assertSame(false, $object->is_empty(), "Object is empty");
- $this->assertSame(false, $object->is_error(), "Object is error");
- $this->assertSame(1721, $object->max(), "Max message UID");
- $this->assertSame(1, $object->min(), "Min message UID");
- $this->assertSame(1721, $object->count_messages(), "Messages count");
- $this->assertSame(1691, $object->exists(1720, true), "Message exists");
- $this->assertSame(true, $object->exists(1720), "Message exists (bool)");
- $this->assertSame(1, $object->get_element('FIRST'), "Get first element");
- $this->assertSame(1719, $object->get_element('LAST'), "Get last element");
- $this->assertSame(14, (int) $object->get_element(2), "Get specified element");
-
- $clone = clone $object;
- $clone->filter(array(7));
- $clone = $clone->get_tree();
-
- $this->assertSame(1, count($clone), "Structure check");
- $this->assertSame(3, count($clone[7]), "Structure check");
- $this->assertSame(0, count($clone[7][12]), "Structure check");
- $this->assertSame(1, count($clone[7][167]), "Structure check");
- $this->assertSame(0, count($clone[7][167][197]), "Structure check");
- $this->assertSame(2, count($clone[7][458]), "Structure check");
- $this->assertSame(1, count($clone[7][458][460]), "Structure check");
- $this->assertSame(0, count($clone[7][458][460][463]), "Structure check");
- $this->assertSame(1, count($clone[7][458][464]), "Structure check");
- $this->assertSame(0, count($clone[7][458][464][471]), "Structure check");
-
- $object->filter(array(784));
- $this->assertSame(118, $object->count_messages(), "Messages filter");
- $this->assertSame(1, $object->count(), "Messages filter (count)");
- }
-}
diff --git a/tests/Framework/Smtp.php b/tests/Framework/Smtp.php
deleted file mode 100644
index 4bd78d097..000000000
--- a/tests/Framework/Smtp.php
+++ /dev/null
@@ -1,20 +0,0 @@
-assertInstanceOf('rcube_smtp', $object, "Class constructor");
- }
-}
diff --git a/tests/Framework/Spellchecker.php b/tests/Framework/Spellchecker.php
deleted file mode 100644
index 9c3e92ffd..000000000
--- a/tests/Framework/Spellchecker.php
+++ /dev/null
@@ -1,20 +0,0 @@
-assertInstanceOf('rcube_spellchecker', $object, "Class constructor");
- }
-}
diff --git a/tests/Framework/StringReplacer.php b/tests/Framework/StringReplacer.php
deleted file mode 100644
index 0fa7fae34..000000000
--- a/tests/Framework/StringReplacer.php
+++ /dev/null
@@ -1,75 +0,0 @@
-assertInstanceOf('rcube_string_replacer', $sr, "Class constructor");
- }
-
- /**
- * Data for test_replace()
- */
- function data_replace()
- {
- return array(
- array('http://domain.tld/path*path2', 'http://domain.tld/path*path2'),
- array("Click this link:\nhttps://mail.xn--brderli-o2a.ch/rc/ EOF", "Click this link:\nhttps://mail.xn--brderli-o2a.ch/rc/ EOF"),
- array('Start http://localhost/?foo End', 'Start http://localhost/?foo End'),
- array('http://localhost/?foo=bar. Period', 'http://localhost/?foo=bar. Period'),
- array('www.domain.tld', 'www.domain.tld'),
- array('WWW.DOMAIN.TLD', 'WWW.DOMAIN.TLD'),
- array('[http://link.com]', '[http://link.com]'),
- array('http://link.com?a[]=1', 'http://link.com?a[]=1'),
- array('http://link.com?a[]', 'http://link.com?a[]'),
- array('(http://link.com)', '(http://link.com)'),
- array('http://link.com?a(b)c', 'http://link.com?a(b)c'),
- array('http://link.com?(link)', 'http://link.com?(link)'),
- array('https://github.com/a/b/compare/3a0f82...1f4b2a after', 'https://github.com/a/b/compare/3a0f82...1f4b2a after'),
- array('http://', 'http://'),
- array('http://', 'http://'),
- array('1@1.com www.domain.tld', '1@1.com www.domain.tld'),
- array(' www.domain.tld ', ' www.domain.tld '),
- array(' www.domain.tld/#!download|856p1|2 ', ' www.domain.tld/#!download|856p1|2 '),
- );
- }
-
- /**
- * @dataProvider data_replace
- */
- function test_replace($input, $output)
- {
- $replacer = new rcube_string_replacer;
- $result = $replacer->replace($input);
- $result = $replacer->resolve($result);
-
- $this->assertEquals($output, $result);
- }
-
- function test_linkrefs()
- {
- $input = "This is a sample message [1] to test the new linkref [ref0] replacement feature of [Roundcube].\n";
- $input.= "\n";
- $input.= "[1] http://en.wikipedia.org/wiki/Email\n";
- $input.= "[ref0] www.link-ref.com\n";
-
- $replacer = new rcube_string_replacer;
- $result = $replacer->replace($input);
- $result = $replacer->resolve($result);
-
- $this->assertContains('[1] to', $result, "Numeric linkref replacements");
- $this->assertContains('[ref0] repl', $result, "Alphanum linkref replacements");
- $this->assertContains('of [Roundcube].', $result, "Don't touch strings wihtout an index entry");
- }
-}
diff --git a/tests/Framework/User.php b/tests/Framework/User.php
deleted file mode 100644
index 3b1983c58..000000000
--- a/tests/Framework/User.php
+++ /dev/null
@@ -1,20 +0,0 @@
-assertInstanceOf('rcube_user', $user, "Class constructor");
- }
-}
diff --git a/tests/Framework/Utils.php b/tests/Framework/Utils.php
deleted file mode 100644
index 1f1e57b0e..000000000
--- a/tests/Framework/Utils.php
+++ /dev/null
@@ -1,337 +0,0 @@
-', 'Encoded html within email is invalid'),
- array('email.domain.com', 'Missing @'),
- array('email@domain@domain.com', 'Two @ sign'),
- array('.email@domain.com', 'Leading dot in address is not allowed'),
- array('email.@domain.com', 'Trailing dot in address is not allowed'),
- array('email..email@domain.com', 'Multiple dots'),
- array('あいうえお@domain.com', 'Unicode char as address'),
- array('email@domain.com (Joe Smith)', 'Text followed email is not allowed'),
- array('email@domain', 'Missing top level domain (.com/.net/.org/etc)'),
- array('email@-domain.com', 'Leading dash in front of domain is invalid'),
-// array('email@domain.web', '.web is not a valid top level domain'),
- array('email@123.123.123.123', 'IP address without brackets'),
- array('email@2001:2d12:c4fe:5afe::1', 'IPv6 address without brackets'),
- array('email@IPv6:2001:2d12:c4fe:5afe::1', 'IPv6 address without brackets (2)'),
- array('email@[111.222.333.44444]', 'Invalid IP format'),
- array('email@[111.222.255.257]', 'Invalid IP format (2)'),
- array('email@[.222.255.257]', 'Invalid IP format (3)'),
- array('email@[::1]', 'Invalid IPv6 format (1)'),
- array('email@[IPv6:2001:23x2:1]', 'Invalid IPv6 format (2)'),
- array('email@[IPv6:1111:2222:33333::4444:5555]', 'Invalid IPv6 format (3)'),
- array('email@[IPv6:1111::3333::4444:5555]', 'Invalid IPv6 format (4)'),
- array('email@domain..com', 'Multiple dot in the domain portion is invalid'),
- );
- }
-
- /**
- * @dataProvider data_valid_email
- */
- function test_valid_email($email, $title)
- {
- $this->assertTrue(rcube_utils::check_email($email, false), $title);
- }
-
- /**
- * @dataProvider data_invalid_email
- */
- function test_invalid_email($email, $title)
- {
- $this->assertFalse(rcube_utils::check_email($email, false), $title);
- }
-
- /**
- * Valid IP addresses for test_valid_ip()
- */
- function data_valid_ip()
- {
- return array(
- array('0.0.0.0'),
- array('123.123.123.123'),
- array('::'),
- array('::1'),
- array('::1.2.3.4'),
- array('2001:2d12:c4fe:5afe::1'),
- );
- }
-
- /**
- * Valid IP addresses for test_invalid_ip()
- */
- function data_invalid_ip()
- {
- return array(
- array(''),
- array(0),
- array('123.123.123.1234'),
- array('1.1.1.1.1'),
- array('::1.2.3.260'),
- array('::1.0'),
- array('2001::c4fe:5afe::1'),
- );
- }
-
- /**
- * @dataProvider data_valid_ip
- */
- function test_valid_ip($ip)
- {
- $this->assertTrue(rcube_utils::check_ip($ip));
- }
-
- /**
- * @dataProvider data_invalid_ip
- */
- function test_invalid_ip($ip)
- {
- $this->assertFalse(rcube_utils::check_ip($ip));
- }
-
- /**
- * Data for test_rep_specialchars_output()
- */
- function data_rep_specialchars_output()
- {
- return array(
- array('', '', 'abc', 'abc'),
- array('', '', '?', '?'),
- array('', '', '"', '"'),
- array('', '', '<', '<'),
- array('', '', '>', '>'),
- array('', '', '&', '&'),
- array('', '', '&', '&'),
- array('', '', '', '<a>'),
- array('', 'remove', '', ''),
- );
- }
-
- /**
- * Test for rep_specialchars_output
- * @dataProvider data_rep_specialchars_output
- */
- function test_rep_specialchars_output($type, $mode, $str, $res)
- {
- $result = rcube_utils::rep_specialchars_output(
- $str, $type ? $type : 'html', $mode ? $mode : 'strict');
-
- $this->assertEquals($result, $res);
- }
-
- /**
- * rcube_utils::mod_css_styles()
- */
- function test_mod_css_styles()
- {
- $css = file_get_contents(TESTS_DIR . 'src/valid.css');
- $mod = rcube_utils::mod_css_styles($css, 'rcmbody');
-
- $this->assertRegExp('/#rcmbody\s+\{/', $mod, "Replace body style definition");
- $this->assertRegExp('/#rcmbody h1\s\{/', $mod, "Prefix tag styles (single)");
- $this->assertRegExp('/#rcmbody h1, #rcmbody h2, #rcmbody h3, #rcmbody textarea\s+\{/', $mod, "Prefix tag styles (multiple)");
- $this->assertRegExp('/#rcmbody \.noscript\s+\{/', $mod, "Prefix class styles");
-
- $css = file_get_contents(TESTS_DIR . 'src/media.css');
- $mod = rcube_utils::mod_css_styles($css, 'rcmbody');
-
- $this->assertContains('#rcmbody table[class=w600]', $mod, 'Replace styles nested in @media block');
- $this->assertContains('#rcmbody {width:600px', $mod, 'Replace body selector nested in @media block');
- }
-
- /**
- * rcube_utils::mod_css_styles()
- */
- function test_mod_css_styles_xss()
- {
- $mod = rcube_utils::mod_css_styles("body.main2cols { background-image: url('../images/leftcol.png'); }", 'rcmbody');
- $this->assertEquals("/* evil! */", $mod, "No url() values allowed");
-
- $mod = rcube_utils::mod_css_styles("@import url('http://localhost/somestuff/css/master.css');", 'rcmbody');
- $this->assertEquals("/* evil! */", $mod, "No import statements");
-
- $mod = rcube_utils::mod_css_styles("left:expression(document.body.offsetWidth-20)", 'rcmbody');
- $this->assertEquals("/* evil! */", $mod, "No expression properties");
-
- $mod = rcube_utils::mod_css_styles("left:exp/* */ression( alert('xss3') )", 'rcmbody');
- $this->assertEquals("/* evil! */", $mod, "Don't allow encoding quirks");
-
- $mod = rcube_utils::mod_css_styles("background:\\0075\\0072\\006c( javascript:alert('xss') )", 'rcmbody');
- $this->assertEquals("/* evil! */", $mod, "Don't allow encoding quirks (2)");
- }
-
- /**
- * Check rcube_utils::explode_quoted_string()
- */
- function test_explode_quoted_string()
- {
- $data = array(
- '"a,b"' => array('"a,b"'),
- '"a,b","c,d"' => array('"a,b"','"c,d"'),
- '"a,\\"b",d' => array('"a,\\"b"', 'd'),
- );
-
- foreach ($data as $text => $res) {
- $result = rcube_utils::explode_quoted_string(',', $text);
- $this->assertSame($res, $result);
- }
- }
-
- /**
- * Check rcube_utils::explode_quoted_string() compat. with explode()
- */
- function test_explode_quoted_string_compat()
- {
- $data = array('', 'a,b,c', 'a', ',', ',a');
-
- foreach ($data as $text) {
- $result = rcube_utils::explode_quoted_string(',', $text);
- $this->assertSame(explode(',', $text), $result);
- }
- }
-
- /**
- * rcube_utils::get_boolean()
- */
- function test_get_boolean()
- {
- $input = array(
- false, 'false', '0', 'no', 'off', 'nein', 'FALSE', '', null,
- );
-
- foreach ($input as $idx => $value) {
- $this->assertFalse(get_boolean($value), "Invalid result for $idx test item");
- }
-
- $input = array(
- true, 'true', '1', 1, 'yes', 'anything', 1000,
- );
-
- foreach ($input as $idx => $value) {
- $this->assertTrue(get_boolean($value), "Invalid result for $idx test item");
- }
- }
-
- /**
- * rcube:utils::file2class()
- */
- function test_file2class()
- {
- $test = array(
- array('', '', 'unknown'),
- array('text', 'text', 'text'),
- array('image/png', 'image.png', 'image png'),
- );
-
- foreach ($test as $v) {
- $result = rcube_utils::file2class($v[0], $v[1]);
- $this->assertSame($v[2], $result);
- }
- }
-
- /**
- * rcube:utils::strtotime()
- */
- function test_strtotime()
- {
- $test = array(
- '1' => 1,
- '' => 0,
- '2013-04-22' => 1366581600,
- '2013/04/22' => 1366581600,
- '2013.04.22' => 1366581600,
- '22-04-2013' => 1366581600,
- '22/04/2013' => 1366581600,
- '22.04.2013' => 1366581600,
- '22.4.2013' => 1366581600,
- '20130422' => 1366581600,
- );
-
- foreach ($test as $datetime => $ts) {
- $result = rcube_utils::strtotime($datetime);
- $this->assertSame($ts, $result, "Error parsing date: $datetime");
- }
- }
-
- /**
- * rcube:utils::anytodatetime()
- */
- function test_anytodatetime()
- {
- $test = array(
- '2013-04-22' => '2013-04-22',
- '2013/04/22' => '2013-04-22',
- '2013.04.22' => '2013-04-22',
- '22-04-2013' => '2013-04-22',
- '22/04/2013' => '2013-04-22',
- '22.04.2013' => '2013-04-22',
- '04/22/2013' => '2013-04-22',
- '22.4.2013' => '2013-04-22',
- '20130422' => '2013-04-22',
- '1900-10-10' => '1900-10-10',
- '01-01-1900' => '1900-01-01',
- '01/30/1960' => '1960-01-30'
- );
-
- foreach ($test as $datetime => $ts) {
- $result = rcube_utils::anytodatetime($datetime);
- $this->assertSame($ts, $result ? $result->format('Y-m-d') : '', "Error parsing date: $datetime");
- }
- }
-
- /**
- * rcube:utils::normalize _string()
- */
- function test_normalize_string()
- {
- $test = array(
- '' => '',
- 'abc def' => 'abc def',
- );
-
- foreach ($test as $input => $output) {
- $result = rcube_utils::normalize_string($input);
- $this->assertSame($output, $result);
- }
- }
-}
diff --git a/tests/Framework/VCard.php b/tests/Framework/VCard.php
deleted file mode 100644
index 3353b5b13..000000000
--- a/tests/Framework/VCard.php
+++ /dev/null
@@ -1,119 +0,0 @@
-_srcpath('apple.vcf')));
-
- $this->assertTrue($vcard->business, "Identify as business record");
- $this->assertEquals("Apple Computer AG", $vcard->displayname, "FN => displayname");
- $this->assertEquals("", $vcard->firstname, "No person name set");
- }
-
- function test_parse_two()
- {
- $vcard = new rcube_vcard(file_get_contents($this->_srcpath('johndoe.vcf')), null);
-
- $this->assertFalse($vcard->business, "Identify as private record");
- $this->assertEquals("John Doë", $vcard->displayname, "Decode according to charset attribute");
- $this->assertEquals("roundcube.net", $vcard->organization, "Test organization field");
- $this->assertCount(2, $vcard->email, "List two e-mail addresses");
- $this->assertEquals("roundcube@gmail.com", $vcard->email[0], "Use PREF e-mail as primary");
- }
-
- /**
- * Make sure MOBILE phone is returned as CELL (as specified in standard)
- */
- function test_parse_three()
- {
- $vcard = new rcube_vcard(file_get_contents($this->_srcpath('johndoe.vcf')), null);
-
- $vcf = $vcard->export();
- $this->assertRegExp('/TEL;CELL:\+987654321/', $vcf, "Return CELL instead of MOBILE (import)");
-
- $vcard = new rcube_vcard();
- $vcard->set('phone', '+987654321', 'MOBILE');
-
- $vcf = $vcard->export();
- $this->assertRegExp('/TEL;TYPE=CELL:\+987654321/', $vcf, "Return CELL instead of MOBILE (set)");
- }
-
- /**
- * Backslash escaping test (#1488896)
- */
- function test_parse_four()
- {
- $vcard = "BEGIN:VCARD\nVERSION:3.0\nN:last\\;;first\\\\;middle\\\\\\;\\\\;prefix;\nFN:test\nEND:VCARD";
- $vcard = new rcube_vcard($vcard, null);
- $vcard = $vcard->get_assoc();
-
- $this->assertEquals("last;", $vcard['surname'], "Decode backslash character");
- $this->assertEquals("first\\", $vcard['firstname'], "Decode backslash character");
- $this->assertEquals("middle\\;\\", $vcard['middlename'], "Decode backslash character");
- $this->assertEquals("prefix", $vcard['prefix'], "Decode backslash character");
- }
-
- /**
- * Backslash parsing test (#1489085)
- */
- function test_parse_five()
- {
- $vcard = "BEGIN:VCARD\nVERSION:3.0\nN:last\\\\\\a;fir\\nst\nURL:http\\://domain.tld\nEND:VCARD";
- $vcard = new rcube_vcard($vcard, null);
- $vcard = $vcard->get_assoc();
-
- $this->assertEquals("last\\a", $vcard['surname'], "Decode dummy backslash character");
- $this->assertEquals("fir\nst", $vcard['firstname'], "Decode backslash character");
- $this->assertEquals("http://domain.tld", $vcard['website:other'][0], "Decode dummy backslash character");
- }
-
- function test_import()
- {
- $input = file_get_contents($this->_srcpath('apple.vcf'));
- $input .= file_get_contents($this->_srcpath('johndoe.vcf'));
-
- $vcards = rcube_vcard::import($input);
-
- $this->assertCount(2, $vcards, "Detected 2 vcards");
- $this->assertEquals("Apple Computer AG", $vcards[0]->displayname, "FN => displayname");
- $this->assertEquals("John Doë", $vcards[1]->displayname, "Displayname with correct charset");
-
- // http://trac.roundcube.net/ticket/1485542
- $vcards2 = rcube_vcard::import(file_get_contents($this->_srcpath('thebat.vcf')));
- $this->assertEquals("Iksiñski", $vcards2[0]->surname, "Detect charset in encoded values");
- }
-
- function test_import_photo_encoding()
- {
- $input = file_get_contents($this->_srcpath('photo.vcf'));
-
- $vcards = rcube_vcard::import($input);
- $vcard = $vcards[0]->get_assoc();
-
- $this->assertCount(1, $vcards, "Detected 1 vcard");
-
- // ENCODING=b case (#1488683)
- $this->assertEquals("/9j/4AAQSkZJRgABAQA", substr(base64_encode($vcard['photo']), 0, 19), "Photo decoding");
- $this->assertEquals("Müller", $vcard['surname'], "Unicode characters");
- }
-
- function test_encodings()
- {
- $input = file_get_contents($this->_srcpath('utf-16_sample.vcf'));
-
- $vcards = rcube_vcard::import($input);
- $this->assertEquals("Ǽgean ĽdaMonté", $vcards[0]->displayname, "Decoded from UTF-16");
- }
-}
diff --git a/tests/Framework/Washtml.php b/tests/Framework/Washtml.php
deleted file mode 100644
index 7485d4383..000000000
--- a/tests/Framework/Washtml.php
+++ /dev/null
@@ -1,127 +0,0 @@
-Firefox'
- .'Internet Explorer
';
-
- $washer = new rcube_washtml;
- $washed = $washer->wash($html);
-
- $this->assertNotRegExp('/data:text/', $washed, "Remove data:text/html links");
- $this->assertNotRegExp('/vbscript:/', $washed, "Remove vbscript: links");
- }
-
- /**
- * Test fixing of invalid href (#1488940)
- */
- function test_href()
- {
- $html = "Firefox";
-
- $washer = new rcube_washtml;
- $washed = $washer->wash($html);
-
- $this->assertRegExp('|href="http://test.com">|', $washed, "Link href with newlines (#1488940)");
- }
-
- /**
- * Test handling HTML comments
- */
- function test_comments()
- {
- $washer = new rcube_washtml;
-
- $html = "
p2
";
- $washed = $washer->wash($html);
-
- $this->assertEquals('p2
', $washed, "HTML conditional comments (#1489004)");
-
- $html = "test
', $washed, "HTML invalid comments (#1487759)");
- }
-
- /**
- * Test fixing of invalid self-closing elements (#1489137)
- */
- function test_self_closing()
- {
- $html = "