Browse Source

Rename option "ssl" to "_ssl" for consitency with other options.

ADmad 11 years ago
parent
commit
56022b6459
2 changed files with 9 additions and 19 deletions
  1. 4 4
      src/Routing/Router.php
  2. 5 15
      tests/TestCase/Routing/RouterTest.php

+ 4 - 4
src/Routing/Router.php

@@ -680,7 +680,7 @@ class Router {
  * - `_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'
@@ -757,9 +757,9 @@ class Router {
 				$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.

+ 5 - 15
tests/TestCase/Routing/RouterTest.php

@@ -1045,15 +1045,6 @@ class RouterTest extends TestCase {
 		));
 		$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);
 	}
 
 /**
@@ -1819,12 +1810,12 @@ class RouterTest extends TestCase {
 		);
 
 		$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);
 	}
@@ -1853,12 +1844,12 @@ class RouterTest extends TestCase {
 		);
 
 		$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);
 	}
@@ -2087,7 +2078,6 @@ class RouterTest extends TestCase {
 
 		$result = Router::parse('/blog/foobar');
 		$this->assertSame([], $result);
-
 	}
 
 /**
@@ -2503,7 +2493,7 @@ class RouterTest extends TestCase {
 			'controller' => 'posts',
 			'action' => 'view',
 			'pass' => array(1),
-			'ext' => 'json',
+			'_ext' => 'json',
 		));
 		$request->query = [];
 		$result = Router::reverse($request);