コード例 #1
0
ファイル: BlockTest.php プロジェクト: rganin/magelight
 public function testUrl()
 {
     $match = 'test';
     $params = ['xxx' => '1', 'yyy' => '2'];
     $type = \Magelight\Helpers\UrlHelper::TYPE_HTTP;
     $addOnlyMaskParams = false;
     $urlHelperMock = $this->getMock(\Magelight\Helpers\UrlHelper::class, [], [], '', false);
     \Magelight\Helpers\UrlHelper::forgeMock($urlHelperMock);
     $urlHelperMock->expects($this->once())->method('getUrl')->with($match, $params, $type, $addOnlyMaskParams)->will($this->returnValue('http://localhost/test?xxx=1&yyy=2'));
     $block = \Magelight\Block::forge();
     $this->assertEquals('http://localhost/test?xxx=1&yyy=2', $block->url($match, $params, $type, $addOnlyMaskParams));
 }
コード例 #2
0
ファイル: ControllerTest.php プロジェクト: rganin/magelight
 public function testRedirectInternal()
 {
     $url = 'http://url/match?param=value';
     $urlHelperMock = $this->getMock(\Magelight\Helpers\UrlHelper::class, [], [], '', false);
     $urlHelperMock->expects($this->once())->method('getUrl')->with('match', ['param' => 'value'], 'http')->will($this->returnValue('http://url/match?param=value'));
     \Magelight\Helpers\UrlHelper::forgeMock($urlHelperMock);
     $this->serverMock->expects($this->once())->method('sendHeader')->with("Location: " . $url);
     $this->appMock->expects($this->once())->method('shutdown');
     $this->controller->redirectInternal('match', ['param' => 'value']);
 }