[TASK] Update caching framework to latest FLOW3 version
[Packages/TYPO3.CMS.git] / tests / t3lib / class.t3lib_htmlmailTest.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2010-2011 Christian Kuhn <lolli@schwarzbu.ch>
6 * All rights reserved
7 *
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.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 *
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.
21 *
22 * This copyright notice MUST APPEAR in all copies of the script!
23 ***************************************************************/
24
25 /**
26 * Testcase for class t3lib_htmlmail
27 *
28 * @author Christian Kuhn <lolli@schwarzbu.ch>
29 * @package TYPO3
30 * @subpackage t3lib
31 */
32 class t3lib_htmlmailTest extends tx_phpunit_testcase {
33 /**
34 * Data provider for regexCreatedWithTagRegexSplitsString
35 */
36 public static function regexCreatedWithTagRegexSplitsStringDataProvider() {
37 return array(
38 'single split without whitespace' => array(
39 'p',
40 '<p>foo</p>',
41 array('<p>foo</p>')
42 ),
43 'single split' => array(
44 'p',
45 '<p class="1">foo</p>',
46 array('', 'class="1">foo</p>')
47 ),
48 'multiple splits' => array(
49 'p',
50 '<p class="1">foo</p><p class="2">bar</p>',
51 array('','class="1">foo</p>','class="2">bar</p>')
52 ),
53 'multiple splits with multiple tags' => array(
54 array('div', 'p'),
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>'),
57 ),
58 'case insenitive split' => array(
59 array('p', 'div'),
60 '<b><DiV class="div"><P class="p1">foo</P></div></b>',
61 array('<b>', 'class="div">', 'class="p1">foo</P></div></b>'),
62 ),
63 );
64 }
65
66 /**
67 * @test
68 * @dataProvider regexCreatedWithTagRegexSplitsStringDataProvider
69 */
70 public function regexCreatedWithTagRegexSplitsString($tag, $testString, $expectedResult) {
71 $regex = t3lib_htmlmail::tag_regex($tag);
72 $this->assertSame($expectedResult, preg_split($regex, $testString));
73 }
74 }
75 ?>