|
|
@@ -564,13 +564,15 @@ class RouteTest extends TestCase
|
|
|
['controller' => 'posts', 'action' => 'index', '_host' => 'example.com'],
|
|
|
$context
|
|
|
);
|
|
|
+ // Http has port 80 as default, do not include it in the url
|
|
|
$this->assertEquals('http://example.com/posts/index', $result);
|
|
|
|
|
|
$result = $route->match(
|
|
|
['controller' => 'posts', 'action' => 'index', '_scheme' => 'webcal'],
|
|
|
$context
|
|
|
);
|
|
|
- $this->assertEquals('webcal://foo.com/posts/index', $result);
|
|
|
+ // Webcal is not on port 80 by default, include it in url
|
|
|
+ $this->assertEquals('webcal://foo.com:80/posts/index', $result);
|
|
|
|
|
|
$result = $route->match(
|
|
|
['controller' => 'posts', 'action' => 'index', '_port' => '8080'],
|
|
|
@@ -596,6 +598,26 @@ class RouteTest extends TestCase
|
|
|
$context
|
|
|
);
|
|
|
$this->assertEquals('https://example.com:8080/dir/posts/index', $result);
|
|
|
+
|
|
|
+ $context = [
|
|
|
+ '_host' => 'foo.com',
|
|
|
+ '_scheme' => 'http',
|
|
|
+ '_port' => 8080,
|
|
|
+ '_base' => ''
|
|
|
+ ];
|
|
|
+ $result = $route->match(
|
|
|
+ [
|
|
|
+ 'controller' => 'posts',
|
|
|
+ 'action' => 'index',
|
|
|
+ '_port' => '8080',
|
|
|
+ '_host' => 'example.com',
|
|
|
+ '_scheme' => 'https',
|
|
|
+ '_base' => '/dir'
|
|
|
+ ],
|
|
|
+ $context
|
|
|
+ );
|
|
|
+ // Https scheme is not on port 8080 by default, include the port
|
|
|
+ $this->assertEquals('https://example.com:8080/dir/posts/index', $result);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -662,6 +684,17 @@ class RouteTest extends TestCase
|
|
|
'_host' => 'foo.example.com'
|
|
|
]);
|
|
|
$this->assertSame('http://foo.example.com/fallback', $result);
|
|
|
+
|
|
|
+ $result = $route->match([
|
|
|
+ 'controller' => 'Articles',
|
|
|
+ 'action' => 'index',
|
|
|
+ ], [
|
|
|
+ '_scheme' => 'https',
|
|
|
+ '_host' => 'foo.example.com',
|
|
|
+ '_port' => 8080
|
|
|
+ ]);
|
|
|
+ // When the port and scheme in the context are not present in the original url, they should be added
|
|
|
+ $this->assertSame('https://foo.example.com:8080/fallback', $result);
|
|
|
}
|
|
|
|
|
|
/**
|