コード例 #1
0
 public function testRewrite()
 {
     $request = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Framework\\App\\RequestInterface')->setPathInfo('fancy/url.html');
     $_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($request));
         $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;
     }
 }