/** * @test */ public function persistSessionTokenWritesTokensToSession() { $_SESSION['installToolFormToken'] = 'foo'; $this->subject->_set('sessionToken', '881ffea2159ac72182557b79dc0c723f5a8d20136f9fab56cdd4f8b3a1dbcfcd'); $this->subject->persistSessionToken(); $this->assertEquals('881ffea2159ac72182557b79dc0c723f5a8d20136f9fab56cdd4f8b3a1dbcfcd', $_SESSION['installToolFormToken']); }
/** * @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'); }
/** * Generates the form to alter the password of the Install Tool * * @return string HTML of the form * @todo Define visibility */ public function alterPasswordForm() { // Get the template file $templateFile = @file_get_contents(PATH_site . $this->templateFilePath . 'AlterPasswordForm.html'); // Get the template part from the file $template = \TYPO3\CMS\Core\Html\HtmlParser::getSubpart($templateFile, '###TEMPLATE###'); // Define the markers content $markers = array('action' => $this->scriptSelf . '?TYPO3_INSTALL[type]=extConfig', 'enterPassword' => 'Enter new password:'******'enterAgain' => 'Enter again:', 'submit' => 'Set new password', 'formToken' => $this->formProtection->generateToken('installToolPassword', 'change')); // Fill the markers $content = \TYPO3\CMS\Core\Html\HtmlParser::substituteMarkerArray($template, $markers, '###|###', TRUE, FALSE); return $content; }