/** * @group ZF-4318 */ public function testServerVariableHttpsToOffDoesNotBuildHttpsUrl() { // Set Preconditions from Issue: $_SERVER['HTTPS'] = "off"; $_SERVER['HTTP_HOST'] = 'localhost'; $_SERVER['SERVER_PORT'] = 80; $this->redirector->setUseAbsoluteUri(true); $this->request->setModuleName('admin')->setControllerName('class')->setActionName('view'); $this->redirector->gotoUrl('/bar/baz'); $test = $this->redirector->getRedirectUrl(); $this->assertNotContains('https://', $test); $this->assertEquals('http://localhost/bar/baz', $test); }
public function testUseAbsoluteUriSetsFullUriInResponse() { $_SERVER['HTTP_HOST'] = 'foobar.example.com'; $_SERVER['SERVER_PORT'] = '4443'; $_SERVER['HTTPS'] = 1; $this->redirector->setUseAbsoluteUri(true); $this->redirector->gotoUrl('/bar/baz'); $headers = $this->response->getHeaders(); $uri = false; foreach ($headers as $header) { if ('Location' == $header['name']) { $uri = $header['value']; } } if (!$uri) { $this->fail('No redirect header set in response'); } $this->assertEquals('https://foobar.example.com:4443/bar/baz', $uri); }