/** * @magentoConfigFixture global/helpers/core/encryption_model Mage_Core_Model_Encryption * @magentoAppIsolation enabled */ public function testGetSecretKeyForwarded() { $request = new Mage_Core_Controller_Request_Http(); $request->setControllerName('controller')->setActionName('action'); $request->initForward()->setControllerName(uniqid())->setActionName(uniqid()); $this->_model->setRequest($request); Mage::getSingleton('Mage_Core_Model_Session')->setData('_form_key', 'salt'); $this->assertEquals('c36d05473b54f437889608cbe8d50339', $this->_model->getSecretKey()); }
/** * Check that secret key generation is based on usage of routeName extracted from request Forward info */ public function testGetSecretKeyGenerationWithRouteNameInForwardInfo() { $routeName = 'adminhtml'; $controllerName = 'catalog'; $actionName = 'index'; $keyFromParams = $this->_model->getSecretKey($routeName, $controllerName, $actionName); $requestMock = $this->getMock('Mage_Core_Controller_Request_Http', array('getBeforeForwardInfo'), array(), '', false); $requestMock->expects($this->at(0))->method('getBeforeForwardInfo')->with('route_name')->will($this->returnValue('adminhtml')); $requestMock->expects($this->at(1))->method('getBeforeForwardInfo')->with('route_name')->will($this->returnValue('adminhtml')); $requestMock->expects($this->at(2))->method('getBeforeForwardInfo')->with('controller_name')->will($this->returnValue('catalog')); $requestMock->expects($this->at(3))->method('getBeforeForwardInfo')->with('controller_name')->will($this->returnValue('catalog')); $requestMock->expects($this->at(4))->method('getBeforeForwardInfo')->with('action_name')->will($this->returnValue('index')); $requestMock->expects($this->at(5))->method('getBeforeForwardInfo')->with('action_name')->will($this->returnValue('index')); $this->_model->setRequest($requestMock); $keyFromRequest = $this->_model->getSecretKey(); $this->assertEquals($keyFromParams, $keyFromRequest); }