Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0493816

Browse filesBrowse files
committed
Add test cases for empty host but non-empty scheme
1 parent c8ad49c commit 0493816
Copy full SHA for 0493816

File tree

1 file changed

+22
-0
lines changed
Filter options

1 file changed

+22
-0
lines changed

‎src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php
+22Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,28 @@ public function testDefaultHostIsUsedWhenContextHostIsEmpty()
479479
$this->assertSame('http://my.fallback.host/app.php/route', $generator->generate('test', array(), UrlGeneratorInterface::ABSOLUTE_URL));
480480
}
481481

482+
public function testDefaultHostIsUsedWhenContextHostIsEmptyAndSchemeIsNot()
483+
{
484+
$routes = $this->getRoutes('test', new Route('/route', array('domain' => 'my.fallback.host'), array('domain' => '.+'), array(), '{domain}', array('http', 'https')));
485+
486+
$generator = $this->getGenerator($routes);
487+
$generator->getContext()->setHost('');
488+
$generator->getContext()->setScheme('https');
489+
490+
$this->assertSame('https://my.fallback.host/app.php/route', $generator->generate('test', array(), UrlGeneratorInterface::ABSOLUTE_URL));
491+
}
492+
493+
public function testHostIsEmptyAndSchemeIsNot()
494+
{
495+
$routes = $this->getRoutes('test', new Route('/route', array(), array(), array(), '', array('http', 'https')));
496+
497+
$generator = $this->getGenerator($routes);
498+
$generator->getContext()->setHost('');
499+
$generator->getContext()->setScheme('https');
500+
501+
$this->assertSame('https:///app.php/route', $generator->generate('test', array(), UrlGeneratorInterface::ABSOLUTE_URL));
502+
}
503+
482504
/**
483505
* @group legacy
484506
*/

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.