|
TYPO3 API
SVNRelease
|
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 2010-2011 Christian Kuhn <lolli@schwarzbu.ch> 00006 * All rights reserved 00007 * 00008 * This script is part of the TYPO3 project. The TYPO3 project is 00009 * free software; you can redistribute it and/or modify 00010 * it under the terms of the GNU General Public License as published by 00011 * the Free Software Foundation; either version 2 of the License, or 00012 * (at your option) any later version. 00013 * 00014 * The GNU General Public License can be found at 00015 * http://www.gnu.org/copyleft/gpl.html. 00016 * 00017 * This script is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 * GNU General Public License for more details. 00021 * 00022 * This copyright notice MUST APPEAR in all copies of the script! 00023 ***************************************************************/ 00024 00025 /** 00026 * Testcase for class t3lib_htmlmail 00027 * 00028 * @author Christian Kuhn <lolli@schwarzbu.ch> 00029 * @package TYPO3 00030 * @subpackage t3lib 00031 */ 00032 class t3lib_htmlmailTest extends tx_phpunit_testcase { 00033 /** 00034 * Data provider for regexCreatedWithTagRegexSplitsString 00035 */ 00036 public static function regexCreatedWithTagRegexSplitsStringDataProvider() { 00037 return array( 00038 'single split without whitespace' => array( 00039 'p', 00040 '<p>foo</p>', 00041 array('<p>foo</p>') 00042 ), 00043 'single split' => array( 00044 'p', 00045 '<p class="1">foo</p>', 00046 array('', 'class="1">foo</p>') 00047 ), 00048 'multiple splits' => array( 00049 'p', 00050 '<p class="1">foo</p><p class="2">bar</p>', 00051 array('','class="1">foo</p>','class="2">bar</p>') 00052 ), 00053 'multiple splits with multiple tags' => array( 00054 array('div', 'p'), 00055 '<b><div class="div"><p class="p1">foo</p><p class="p2">bar</p></div></b>', 00056 array('<b>', 'class="div">', 'class="p1">foo</p>', 'class="p2">bar</p></div></b>'), 00057 ), 00058 'case insenitive split' => array( 00059 array('p', 'div'), 00060 '<b><DiV class="div"><P class="p1">foo</P></div></b>', 00061 array('<b>', 'class="div">', 'class="p1">foo</P></div></b>'), 00062 ), 00063 ); 00064 } 00065 00066 /** 00067 * @test 00068 * @dataProvider regexCreatedWithTagRegexSplitsStringDataProvider 00069 */ 00070 public function regexCreatedWithTagRegexSplitsString($tag, $testString, $expectedResult) { 00071 $regex = t3lib_htmlmail::tag_regex($tag); 00072 $this->assertSame($expectedResult, preg_split($regex, $testString)); 00073 } 00074 } 00075 ?>
1.8.0