/** * @test * @deprecated since 6.2. Test can be removed if injectInstallTool method is dropped */ public function createValidationErrorMessageAddsErrorMessage() { $installTool = $this->getMock('stdClass', array('addErrorMessage'), array(), '', FALSE); $installTool->expects($this->once())->method('addErrorMessage')->with('Validating the security token of this form has failed. ' . 'Please reload the form and submit it again.'); $this->fixture->injectInstallTool($installTool); $this->fixture->_call('createValidationErrorMessage'); }
/** * @test */ public function tokenFromSessionDataIsAvailableForValidateToken() { $sessionToken = '881ffea2159ac72182557b79dc0c723f5a8d20136f9fab56cdd4f8b3a1dbcfcd'; $formName = 'foo'; $action = 'edit'; $formInstanceName = '42'; $tokenId = \TYPO3\CMS\Core\Utility\GeneralUtility::hmac($formName . $action . $formInstanceName . $sessionToken); $_SESSION['installToolFormToken'] = $sessionToken; $this->subject->_call('retrieveSessionToken'); $this->assertTrue($this->subject->validateToken($tokenId, $formName, $action, $formInstanceName)); }