Browse Source

Merge branch '2.0' into 2.1

mark_story 14 years ago
parent
commit
15c7493e39

+ 1 - 1
lib/Cake/Console/Command/SchemaShell.php

@@ -523,7 +523,7 @@ class SchemaShell extends AppShell {
 		))->addSubcommand('update', array(
 			'help' => __d('cake_console', 'Alter the tables based on the schema file.'),
 			'parser' => array(
-				'options' => compact('plugin', 'path', 'file', 'name', 'connection', 'dry', 'snapshot'),
+				'options' => compact('plugin', 'path', 'file', 'name', 'connection', 'dry', 'snapshot', 'force'),
 				'args' => array(
 					'name' => array(
 						'help' => __d('cake_console', 'Name of schema to use.')

+ 1 - 1
lib/Cake/Network/CakeRequest.php

@@ -250,7 +250,7 @@ class CakeRequest implements ArrayAccess {
 		}
 
 		if (!$baseUrl) {
-			$base = dirname(env('SCRIPT_NAME'));
+			$base = dirname(env('PHP_SELF'));
 
 			if ($webroot === 'webroot' && $webroot === basename($base)) {
 				$base = dirname($base);

+ 3 - 0
lib/Cake/Test/Case/Cache/Engine/FileEngineTest.php

@@ -356,6 +356,9 @@ class FileEngineTest extends CakeTestCase {
  * @return void
  */
 	public function testMaskSetting() {
+		if (DS === '\\') {
+			$this->markTestSkipped('File permission testing does not work on Windows.');
+		}
 		Cache::config('mask_test', array('engine' => 'File', 'path' => TMP . 'tests'));
 		$data = 'This is some test content';
 		$write = Cache::write('masking_test', $data, 'mask_test');

+ 5 - 0
lib/Cake/Test/Case/Console/Command/Task/FixtureTaskTest.php

@@ -178,6 +178,11 @@ class FixtureTaskTest extends CakeTestCase {
  * @return void
  */
 	function testImportRecordsNoEscaping() {
+		$db = ConnectionManager::getDataSource('test');
+		if ($db instanceof Sqlserver) {
+			$this->markTestSkipped('This test does not run on SQLServer');
+		}
+
 		$Article = ClassRegistry::init('Article');
 		$Article->updateAll(array('body' => "'Body \"value\"'"));
 

+ 9 - 9
lib/Cake/Test/Case/Network/CakeRequestTest.php

@@ -898,7 +898,7 @@ class CakeRequestTest extends CakeTestCase {
 		Configure::write('App.baseUrl', false);
 
 		$_SERVER['DOCUMENT_ROOT'] = '/cake/repo/branches';
-		$_SERVER['SCRIPT_NAME'] = '/1.2.x.x/app/webroot/index.php';
+		$_SERVER['PHP_SELF'] = '/1.2.x.x/app/webroot/index.php';
 		$_SERVER['PATH_INFO'] = '/posts/view/1';
 
 		$request = new CakeRequest();
@@ -908,7 +908,7 @@ class CakeRequestTest extends CakeTestCase {
 
 
 		$_SERVER['DOCUMENT_ROOT'] = '/cake/repo/branches/1.2.x.x/app/webroot';
-		$_SERVER['SCRIPT_NAME'] = '/index.php';
+		$_SERVER['PHP_SELF'] = '/index.php';
 		$_SERVER['PATH_INFO'] = '/posts/add';
 		$request = new CakeRequest();
 
@@ -917,7 +917,7 @@ class CakeRequestTest extends CakeTestCase {
 		$this->assertEquals($request->url, 'posts/add');
 
 		$_SERVER['DOCUMENT_ROOT'] = '/cake/repo/branches/1.2.x.x/test/';
-		$_SERVER['SCRIPT_NAME'] = '/webroot/index.php';
+		$_SERVER['PHP_SELF'] = '/webroot/index.php';
 		$request = new CakeRequest();
 
 		$this->assertEquals('', $request->base);
@@ -925,7 +925,7 @@ class CakeRequestTest extends CakeTestCase {
 
 
 		$_SERVER['DOCUMENT_ROOT'] = '/some/apps/where';
-		$_SERVER['SCRIPT_NAME'] = '/app/webroot/index.php';
+		$_SERVER['PHP_SELF'] = '/app/webroot/index.php';
 		$request = new CakeRequest();
 
 		$this->assertEquals($request->base, '');
@@ -934,7 +934,7 @@ class CakeRequestTest extends CakeTestCase {
 		Configure::write('App.dir', 'auth');
 
 		$_SERVER['DOCUMENT_ROOT'] = '/cake/repo/branches';
-		$_SERVER['SCRIPT_NAME'] = '/demos/auth/webroot/index.php';
+		$_SERVER['PHP_SELF'] = '/demos/auth/webroot/index.php';
 
 		$request = new CakeRequest();
 
@@ -944,7 +944,7 @@ class CakeRequestTest extends CakeTestCase {
 		Configure::write('App.dir', 'code');
 
 		$_SERVER['DOCUMENT_ROOT'] = '/Library/WebServer/Documents';
-		$_SERVER['SCRIPT_NAME'] = '/clients/PewterReport/code/webroot/index.php';
+		$_SERVER['PHP_SELF'] = '/clients/PewterReport/code/webroot/index.php';
 		$request = new CakeRequest();
 
 		$this->assertEquals($request->base, '/clients/PewterReport/code');
@@ -958,7 +958,7 @@ class CakeRequestTest extends CakeTestCase {
  */
 	public function testBaseUrlwithModRewriteAlias() {
 		$_SERVER['DOCUMENT_ROOT'] = '/home/aplusnur/public_html';
-		$_SERVER['SCRIPT_NAME'] = '/control/index.php';
+		$_SERVER['PHP_SELF'] = '/control/index.php';
 
 		Configure::write('App.base', '/control');
 
@@ -972,7 +972,7 @@ class CakeRequestTest extends CakeTestCase {
 		Configure::write('App.webroot', 'newaffiliate');
 
 		$_SERVER['DOCUMENT_ROOT'] = '/var/www/abtravaff/html';
-		$_SERVER['SCRIPT_NAME'] = '/newaffiliate/index.php';
+		$_SERVER['PHP_SELF'] = '/newaffiliate/index.php';
 		$request = new CakeRequest();
 
 		$this->assertEquals($request->base, '/newaffiliate');
@@ -1113,7 +1113,7 @@ class CakeRequestTest extends CakeTestCase {
  */
 	public function testGetParamsWithDot() {
 		$_GET['/posts/index/add_add'] = '';
-		$_SERVER['SCRIPT_NAME'] = '/cake_dev/app/webroot/index.php';
+		$_SERVER['PHP_SELF'] = '/cake_dev/app/webroot/index.php';
 		$_SERVER['REQUEST_URI'] = '/cake_dev/posts/index/add.add';
 
 		$request = new CakeRequest();

+ 1 - 1
lib/Cake/Test/Case/Routing/DispatcherTest.php

@@ -877,7 +877,7 @@ class DispatcherTest extends CakeTestCase {
  */
 	public function testAutomaticPluginDispatch() {
 		$_POST = array();
-		$_SERVER['SCRIPT_NAME'] = '/cake/repo/branches/1.2.x.x/index.php';
+		$_SERVER['PHP_SELF'] = '/cake/repo/branches/1.2.x.x/index.php';
 
 		Router::reload();
 		$Dispatcher = new TestDispatcher();

+ 2 - 0
lib/Cake/Test/Case/Utility/InflectorTest.php

@@ -108,6 +108,7 @@ class InflectorTest extends CakeTestCase {
 		$this->assertEquals(Inflector::singularize('curves'), 'curve');
 		$this->assertEquals(Inflector::singularize('cafes'), 'cafe');
 		$this->assertEquals(Inflector::singularize('roofs'), 'roof');
+		$this->assertEquals(Inflector::singularize('foes'), 'foe');
 
 		$this->assertEquals(Inflector::singularize(''), '');
 	}
@@ -158,6 +159,7 @@ class InflectorTest extends CakeTestCase {
 		$this->assertEquals(Inflector::pluralize('bureau'), 'bureaus');
 		$this->assertEquals(Inflector::pluralize('cafe'), 'cafes');
 		$this->assertEquals(Inflector::pluralize('roof'), 'roofs');
+		$this->assertEquals(Inflector::pluralize('foe'), 'foes');
 		$this->assertEquals(Inflector::pluralize(''), '');
 	}
 

+ 1 - 0
lib/Cake/Utility/Inflector.php

@@ -144,6 +144,7 @@ class Inflector {
 			'.*[nrlm]ese', '.*deer', '.*fish', '.*measles', '.*ois', '.*pox', '.*sheep', '.*ss'
 		),
 		'irregular' => array(
+			'foes' => 'foe',
 			'waves' => 'wave',
 			'curves' => 'curve'
 		)

+ 4 - 1
lib/Cake/Utility/Sanitize.php

@@ -69,7 +69,10 @@ class Sanitize {
 		if (is_numeric($string) || $string === null || is_bool($string)) {
 			return $string;
 		}
-		$string = substr($db->value($string), 1);
+		$string = $db->value($string, 'string');
+		if ($string[0] === 'N') {
+			$string = substr($string, 2);
+		}
 		$string = substr($string, 0, -1);
 		return $string;
 	}