35 $GLOBALS[
'TSFE']->cObj = $this->getMock(
'TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer', array(), array(),
'', FALSE);
36 $this->viewHelper = $this->getMock($this->
buildAccessibleProxy(
'TYPO3\\CMS\\Fluid\\ViewHelpers\\Link\\EmailViewHelper'), array(
'renderChildren'));
38 $this->viewHelper->initializeArguments();
45 $mockTagBuilder = $this->getMock(
'TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\TagBuilder', array(
'setTagName',
'addAttribute',
'setContent'));
46 $mockTagBuilder->expects($this->once())->method(
'setTagName')->with(
'a');
47 $mockTagBuilder->expects($this->once())->method(
'addAttribute')->with(
'href',
'mailto:some@email.tld');
48 $mockTagBuilder->expects($this->once())->method(
'setContent')->with(
'some content');
49 $this->viewHelper->_set(
'tag', $mockTagBuilder);
50 $this->viewHelper->expects($this->any())->method(
'renderChildren')->will($this->returnValue(
'some content'));
51 $this->viewHelper->initialize();
52 $this->viewHelper->render(
'some@email.tld');
59 $mockTagBuilder = $this->getMock(
'TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\TagBuilder', array(
'setTagName',
'addAttribute',
'setContent'));
60 $mockTagBuilder->expects($this->once())->method(
'setContent')->with(
'some@email.tld');
61 $this->viewHelper->_set(
'tag', $mockTagBuilder);
62 $this->viewHelper->expects($this->any())->method(
'renderChildren')->will($this->returnValue(NULL));
63 $this->viewHelper->initialize();
64 $this->viewHelper->render(
'some@email.tld');
72 'Plain email' => array(
75 '<a href="mailto:some@email.tld">some@email.tld</a>',
77 'Plain email with spam protection' => array(
80 '<a href="javascript:linkTo_UnCryptMailto(\'nbjmup+tpnfAfnbjm/ume\');">some(at)email.tld</a>',
82 'Plain email with ascii spam protection' => array(
85 '<a href="mailto:some@email.tld">some(at)email.tld</a>',
87 'Susceptible email' => array(
88 '"><script>alert(\'email\')</script>',
90 '<a href="mailto:"><script>alert(\'email\')</script>">"><script>alert(\'email\')</script></a>',
92 'Susceptible email with spam protection' => array(
93 '"><script>alert(\'email\')</script>',
95 '<a href="javascript:linkTo_UnCryptMailto(\'nbjmup+"><tdsjqu>bmfsu(\'fnbjm\')<0tdsjqu>\');">"><script>alert(\'email\')</script></a>',
97 'Susceptible email with ascii spam protection' => array(
98 '"><script>alert(\'email\')</script>',
100 '<a href="mailto:"><script>alert('email')</script>">"><script>alert(\'email\')</script></a>',
112 public function renderEncodesEmailInFrontend($email, $spamProtectEmailAddresses, $expected) {
114 $tsfe = $this->getMock(
'TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', array(
'dummy'), array(),
'',
false);
115 $tsfe->cObj = new \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer();
116 $tsfe->spamProtectEmailAddresses = $spamProtectEmailAddresses;
117 $tsfe->config = array(
119 'spamProtectEmailAddresses_atSubst' =>
'',
120 'spamProtectEmailAddresses_lastDotSubst' =>
'',
124 $mockTagBuilder = $this->getMock(
'TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\TagBuilder', array(
'dummy'));
125 $mockTagBuilder->setTagName =
'a';
126 $viewHelper = $this->getMock($this->
buildAccessibleProxy(
'TYPO3\\CMS\\Fluid\\ViewHelpers\\Link\\EmailViewHelper'), array(
'isFrontendAvailable',
'renderChildren'));
128 $viewHelper->expects($this->once())->method(
'isFrontendAvailable')->willReturn(
true);
129 $viewHelper->expects($this->once())->method(
'renderChildren')->willReturn(null);
renderEncodesEmailInFrontendDataProvider()
injectDependenciesIntoViewHelper(\TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper $viewHelper)
renderCorrectlySetsTagNameAndAttributesAndContent()
renderSetsTagContentToEmailIfRenderChildrenReturnNull()
buildAccessibleProxy($className)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]