/** * Enable the install tool * * @param string $installToolEnableToken * @throws \RuntimeException */ public function enableInstallToolAction($installToolEnableToken) { if (!$this->formProtection->validateToken($installToolEnableToken, 'installTool')) { throw new \RuntimeException('Given form token was not valid', 1369161225); } $this->enableFileService->createInstallToolEnableFile(); $this->forward('index'); }
/** * @test * @expectedException \InvalidArgumentException * @expectedExceptionCode 1425236663 */ public function moduleDispatcherIsCalled() { $GLOBALS['TBE_MODULES'] = array('_PATHS' => array('module_fixture' => __DIR__ . '/../Fixtures/ModuleFixture/')); $this->requestMock->expects($this->any())->method('getQueryParams')->will($this->returnValue(array('M' => 'module_fixture'))); $this->formProtectionMock->expects($this->once())->method('validateToken')->will($this->returnValue(true)); $this->subject->expects($this->once())->method('boot'); $this->subject->expects($this->atLeastOnce())->method('getFormProtection')->will($this->returnValue($this->formProtectionMock)); $this->subject->handleRequest($this->requestMock); }
/** * @test * @expectedException \InvalidArgumentException * @expectedExceptionCode 1425236663 */ public function moduleDispatcherIsCalled() { $GLOBALS['TBE_MODULES'] = array('_PATHS' => array('_dispatcher' => array(), 'module_fixture' => __DIR__ . '/Fixtures/ModuleFixture/')); $_GET['M'] = 'module_fixture'; $this->formProtectionMock->expects($this->once())->method('validateToken')->will($this->returnValue(TRUE)); $this->subject->expects($this->once())->method('boot'); $this->subject->expects($this->once())->method('getFormProtection')->will($this->returnValue($this->formProtectionMock)); $this->subject->handleRequest(); }
/** * Only allow construction if we have a backend session */ public function __construct() { if (!$this->isAuthorizedBackendSession()) { throw new \TYPO3\CMS\Core\Error\Exception('A back-end form protection may only be instantiated if there' . ' is an active back-end session.', 1285067843); } $this->backendUser = $GLOBALS['BE_USER']; parent::__construct(); }