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)); }
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']); }