/** * Warning: this test is not isolated from other tests (Mage::app()->getRequest() and getResponse()) */ public function testRewrite() { $request = Mage::app()->getRequest()->setPathInfo('fancy/url.html'); //$response = new Magento_Test_Response(); $_SERVER['QUERY_STRING'] = 'foo=bar&___fooo=bar'; $this->_model->setRequestPath('fancy/url.html')->setTargetPath('another/fancy/url.html')->setIsSystem(1)->save(); try { $this->assertTrue($this->_model->rewrite(null, $response)); $this->assertEquals('/another/fancy/url.html?foo=bar', $request->getRequestUri()); $this->assertEquals('another/fancy/url.html', $request->getPathInfo()); $this->_model->delete(); } catch (Exception $e) { $this->_model->delete(); throw $e; } }