Navigation Menu

Skip to content

Commit

Permalink
Rename option "ssl" to "_ssl" for consitency with other options.
Browse files Browse the repository at this point in the history
  • Loading branch information
ADmad committed Jul 1, 2014
1 parent 1ea269a commit 56022b6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 19 deletions.
8 changes: 4 additions & 4 deletions src/Routing/Router.php
Expand Up @@ -680,7 +680,7 @@ protected static function _applyUrlFilters($url) {
* - `_port` - Set the port if you need to create links on non-standard ports.
* - `_full` - If true output of `Router::fullBaseUrl()` will be prepended to generated URLs.
* - `#` - Allows you to set URL hash fragments.
* - `ssl` - Set to true to convert the generated URL to https, or false to force http.
* - `_ssl` - Set to true to convert the generated URL to https, or false to force http.
*
* @param string|array $url Cake-relative URL, like "/products/edit/92" or "/presidents/elect/4"
* or an array specifying any of the following: 'controller', 'action', 'plugin'
Expand Down Expand Up @@ -757,9 +757,9 @@ public static function url($url = null, $options = []) {
$frag = '#' . $url['#'];
unset($url['#']);
}
if (isset($url['ssl'])) {
$url['_scheme'] = ($url['ssl'] == true) ? 'https' : 'http';
unset($url['ssl']);
if (isset($url['_ssl'])) {
$url['_scheme'] = ($url['_ssl'] === true) ? 'https' : 'http';
unset($url['_ssl']);
}

// Copy the current action if the controller is the current one.
Expand Down
20 changes: 5 additions & 15 deletions tests/TestCase/Routing/RouterTest.php
Expand Up @@ -1045,15 +1045,6 @@ public function testUrlGenerationWithExtensions() {
));
$expected = '/articles.json';
$this->assertEquals($expected, $result);

$result = Router::url(array(
'plugin' => null,
'controller' => 'articles',
'action' => 'index',
'ext' => 'json'
));
$expected = '/articles.json';
$this->assertEquals($expected, $result);
}

/**
Expand Down Expand Up @@ -1819,12 +1810,12 @@ public function testGenerationWithSslOption() {
);

$result = Router::url(array(
'ssl' => true
'_ssl' => true
));
$this->assertEquals('https://localhost/images/index', $result);

$result = Router::url(array(
'ssl' => false
'_ssl' => false
));
$this->assertEquals('http://localhost/images/index', $result);
}
Expand Down Expand Up @@ -1853,12 +1844,12 @@ public function testGenerateWithSslInSsl() {
);

$result = Router::url(array(
'ssl' => false
'_ssl' => false
));
$this->assertEquals('http://localhost/images/index', $result);

$result = Router::url(array(
'ssl' => true
'_ssl' => true
));
$this->assertEquals('https://localhost/images/index', $result);
}
Expand Down Expand Up @@ -2087,7 +2078,6 @@ public function testParsingWithPatternOnAction() {

$result = Router::parse('/blog/foobar');
$this->assertSame([], $result);

}

/**
Expand Down Expand Up @@ -2503,7 +2493,7 @@ public function testReverseWithExtension() {
'controller' => 'posts',
'action' => 'view',
'pass' => array(1),
'ext' => 'json',
'_ext' => 'json',
));
$request->query = [];
$result = Router::reverse($request);
Expand Down

0 comments on commit 56022b6

Please sign in to comment.