/** * Test that the 'scheme' route requirement is respected during url generation. */ public function testUrlGenerationWithHttpsRequirement() { $url = $this->generator->generate('test_4', array(), TRUE); $this->assertEquals('https://localhost/test/four', $url); $this->routeProcessorManager->expects($this->exactly(1))->method('processOutbound')->with($this->anything()); $options = array('absolute' => TRUE, 'https' => TRUE); $url = $this->generator->generateFromRoute('test_1', array(), $options); $this->assertEquals('https://localhost/hello/world', $url); }
/** * Test that the 'scheme' route requirement is respected during url generation. */ public function testUrlGenerationWithHttpsRequirement() { $url = $this->generator->generate('test_4', array(), TRUE); $this->assertEquals('https://localhost/test/four', $url); // No cacheability to test; UrlGenerator::generate() doesn't support // collecting cacheability metadata. $this->routeProcessorManager->expects($this->exactly(2))->method('processOutbound')->with($this->anything()); $options = array('absolute' => TRUE, 'https' => TRUE); $this->assertGenerateFromRoute('test_1', [], $options, 'https://localhost/hello/world', (new CacheableMetadata())->setCacheMaxAge(Cache::PERMANENT)->setCacheContexts(['url.site'])); }
/** * Test that the 'scheme' route requirement is respected during url generation. */ public function testUrlGenerationWithHttpsRequirement() { $url = $this->generator->generate('test_4', array(), TRUE); $this->assertEquals('https://localhost/test/four', $url); $this->routeProcessorManager->expects($this->exactly(2))->method('processOutbound')->with($this->anything()); $options = array('absolute' => TRUE, 'https' => TRUE); // Mixed-mode sessions are not enabled, so the https option is ignored. $url = $this->generator->generateFromRoute('test_1', array(), $options); $this->assertEquals('http://localhost/hello/world', $url); // Mixed-mode sessions are enabled, so the https option is obeyed. $url = $this->generatorMixedMode->generateFromRoute('test_1', array(), $options); $this->assertEquals('https://localhost/hello/world', $url); }