2 /***************************************************************
5 * (c) 2010-2011 Christian Kuhn <lolli@schwarzbu.ch>
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
17 * This script is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * This copyright notice MUST APPEAR in all copies of the script!
23 ***************************************************************/
26 * Testcase for class t3lib_htmlmail
28 * @author Christian Kuhn <lolli@schwarzbu.ch>
32 class t3lib_htmlmailTest
extends tx_phpunit_testcase
{
34 * Data provider for regexCreatedWithTagRegexSplitsString
36 public static function regexCreatedWithTagRegexSplitsStringDataProvider() {
38 'single split without whitespace' => array(
43 'single split' => array(
45 '<p class="1">foo</p>',
46 array('', 'class="1">foo</p>')
48 'multiple splits' => array(
50 '<p class="1">foo</p><p class="2">bar</p>',
51 array('','class="1">foo</p>','class="2">bar</p>')
53 'multiple splits with multiple tags' => array(
55 '<b><div class="div"><p class="p1">foo</p><p class="p2">bar</p></div></b>',
56 array('<b>', 'class="div">', 'class="p1">foo</p>', 'class="p2">bar</p></div></b>'),
58 'case insenitive split' => array(
60 '<b><DiV class="div"><P class="p1">foo</P></div></b>',
61 array('<b>', 'class="div">', 'class="p1">foo</P></div></b>'),
68 * @dataProvider regexCreatedWithTagRegexSplitsStringDataProvider
70 public function regexCreatedWithTagRegexSplitsString($tag, $testString, $expectedResult) {
71 $regex = t3lib_htmlmail
::tag_regex($tag);
72 $this->assertSame($expectedResult, preg_split($regex, $testString));