Merge branch '2.1' into 2.2

This commit is contained in:
mark_story 2012-04-23 21:50:36 -04:00
commit b6de177ffa
9 changed files with 90 additions and 53 deletions

View file

@ -89,17 +89,24 @@ Cache::config('default', array('engine' => 'File'));
* The settings below can be used to set additional paths to models, views and controllers. * The settings below can be used to set additional paths to models, views and controllers.
* *
* App::build(array( * App::build(array(
* 'Plugin' => array('/full/path/to/plugins/', '/next/full/path/to/plugins/'), * 'Model' => array('/path/to/models', '/next/path/to/models'),
* 'Model' => array('/full/path/to/models/', '/next/full/path/to/models/'), * 'Model/Behavior' => array('/path/to/behaviors', '/next/path/to/behaviors'),
* 'View' => array('/full/path/to/views/', '/next/full/path/to/views/'), * 'Model/Datasource' => array('/path/to/datasources', '/next/path/to/datasources'),
* 'Controller' => array('/full/path/to/controllers/', '/next/full/path/to/controllers/'), * 'Model/Datasource/Database' => array('/path/to/databases', '/next/path/to/database'),
* 'Model/Datasource' => array('/full/path/to/datasources/', '/next/full/path/to/datasources/'), * 'Model/Datasource/Session' => array('/path/to/sessions', '/next/path/to/sessions'),
* 'Model/Behavior' => array('/full/path/to/behaviors/', '/next/full/path/to/behaviors/'), * 'Controller' => array('/path/to/controllers', '/next/path/to/controllers'),
* 'Controller/Component' => array('/full/path/to/components/', '/next/full/path/to/components/'), * 'Controller/Component' => array('/path/to/components', '/next/path/to/components'),
* 'View/Helper' => array('/full/path/to/helpers/', '/next/full/path/to/helpers/'), * 'Controller/Component/Auth' => array('/path/to/auths', '/next/path/to/auths'),
* 'Vendor' => array('/full/path/to/vendors/', '/next/full/path/to/vendors/'), * 'Controller/Component/Acl' => array('/path/to/acls', '/next/path/to/acls'),
* 'Console/Command' => array('/full/path/to/shells/', '/next/full/path/to/shells/'), * 'View' => array('/path/to/views', '/next/path/to/views'),
* 'Locale' => array('/full/path/to/locale/', '/next/full/path/to/locale/') * 'View/Helper' => array('/path/to/helpers', '/next/path/to/helpers'),
* 'Console' => array('/path/to/consoles', '/next/path/to/consoles'),
* 'Console/Command' => array('/path/to/commands', '/next/path/to/commands'),
* 'Console/Command/Task' => array('/path/to/tasks', '/next/path/to/tasks'),
* 'Lib' => array('/path/to/libs', '/next/path/to/libs'),
* 'Locale' => array('/path/to/locales', '/next/path/to/locales'),
* 'Vendor' => array('/path/to/vendors', '/next/path/to/vendors'),
* 'Plugin' => array('/path/to/plugins', '/next/path/to/plugins'),
* )); * ));
* *
*/ */

View file

@ -464,6 +464,8 @@ class ExtractTask extends AppShell {
* @return void * @return void
*/ */
protected function _buildFiles() { protected function _buildFiles() {
$paths = $this->_paths;
$paths[] = realpath(APP) . DS;
foreach ($this->_translations as $domain => $translations) { foreach ($this->_translations as $domain => $translations) {
foreach ($translations as $msgid => $details) { foreach ($translations as $msgid => $details) {
$plural = $details['msgid_plural']; $plural = $details['msgid_plural'];
@ -474,7 +476,7 @@ class ExtractTask extends AppShell {
$occurrences[] = $file . ':' . implode(';', $lines); $occurrences[] = $file . ':' . implode(';', $lines);
} }
$occurrences = implode("\n#: ", $occurrences); $occurrences = implode("\n#: ", $occurrences);
$header = '#: ' . str_replace($this->_paths, '', $occurrences) . "\n"; $header = '#: ' . str_replace($paths, '', $occurrences) . "\n";
if ($plural === false) { if ($plural === false) {
$sentence = "msgid \"{$msgid}\"\n"; $sentence = "msgid \"{$msgid}\"\n";

View file

@ -30,17 +30,24 @@ Cache::config('default', array('engine' => 'File'));
* The settings below can be used to set additional paths to models, views and controllers. * The settings below can be used to set additional paths to models, views and controllers.
* *
* App::build(array( * App::build(array(
* 'Plugin' => array('/full/path/to/plugins/', '/next/full/path/to/plugins/'), * 'Model' => array('/path/to/models', '/next/path/to/models'),
* 'Model' => array('/full/path/to/models/', '/next/full/path/to/models/'), * 'Model/Behavior' => array('/path/to/behaviors', '/next/path/to/behaviors'),
* 'View' => array('/full/path/to/views/', '/next/full/path/to/views/'), * 'Model/Datasource' => array('/path/to/datasources', '/next/path/to/datasources'),
* 'Controller' => array('/full/path/to/controllers/', '/next/full/path/to/controllers/'), * 'Model/Datasource/Database' => array('/path/to/databases', '/next/path/to/database'),
* 'Model/Datasource' => array('/full/path/to/datasources/', '/next/full/path/to/datasources/'), * 'Model/Datasource/Session' => array('/path/to/sessions', '/next/path/to/sessions'),
* 'Model/Behavior' => array('/full/path/to/behaviors/', '/next/full/path/to/behaviors/'), * 'Controller' => array('/path/to/controllers', '/next/path/to/controllers'),
* 'Controller/Component' => array('/full/path/to/components/', '/next/full/path/to/components/'), * 'Controller/Component' => array('/path/to/components', '/next/path/to/components'),
* 'View/Helper' => array('/full/path/to/helpers/', '/next/full/path/to/helpers/'), * 'Controller/Component/Auth' => array('/path/to/auths', '/next/path/to/auths'),
* 'Vendor' => array('/full/path/to/vendors/', '/next/full/path/to/vendors/'), * 'Controller/Component/Acl' => array('/path/to/acls', '/next/path/to/acls'),
* 'Console/Command' => array('/full/path/to/shells/', '/next/full/path/to/shells/'), * 'View' => array('/path/to/views', '/next/path/to/views'),
* 'Locale' => array('/full/path/to/locale/', '/next/full/path/to/locale/') * 'View/Helper' => array('/path/to/helpers', '/next/path/to/helpers'),
* 'Console' => array('/path/to/consoles', '/next/path/to/consoles'),
* 'Console/Command' => array('/path/to/commands', '/next/path/to/commands'),
* 'Console/Command/Task' => array('/path/to/tasks', '/next/path/to/tasks'),
* 'Lib' => array('/path/to/libs', '/next/path/to/libs'),
* 'Locale' => array('/path/to/locales', '/next/path/to/locales'),
* 'Vendor' => array('/path/to/vendors', '/next/path/to/vendors'),
* 'Plugin' => array('/path/to/plugins', '/next/path/to/plugins'),
* )); * ));
* *
*/ */
@ -83,4 +90,4 @@ Cache::config('default', array('engine' => 'File'));
Configure::write('Dispatcher.filters', array( Configure::write('Dispatcher.filters', array(
'AssetDispatcher', 'AssetDispatcher',
'CacheDispatcher' 'CacheDispatcher'
)); ));

View file

@ -420,31 +420,6 @@ class EmailComponent extends Component {
return null; return null;
} }
/**
* Encode the specified string using the current charset
*
* @param string $subject String to encode
* @return string Encoded string
*/
protected function _encode($subject) {
$subject = $this->_strip($subject);
$nl = "\r\n";
if ($this->delivery == 'mail') {
$nl = '';
}
$internalEncoding = function_exists('mb_internal_encoding');
if ($internalEncoding) {
$restore = mb_internal_encoding();
mb_internal_encoding($this->charset);
}
$return = mb_encode_mimeheader($subject, $this->charset, 'B', $nl);
if ($internalEncoding) {
mb_internal_encoding($restore);
}
return $return;
}
/** /**
* Format addresses to be an array with email as key and alias as value * Format addresses to be an array with email as key and alias as value
* *
@ -455,7 +430,7 @@ class EmailComponent extends Component {
$formatted = array(); $formatted = array();
foreach ($addresses as $address) { foreach ($addresses as $address) {
if (preg_match('/((.*))?\s?<(.+)>/', $address, $matches) && !empty($matches[2])) { if (preg_match('/((.*))?\s?<(.+)>/', $address, $matches) && !empty($matches[2])) {
$formatted[$this->_strip($matches[3])] = $this->_encode($matches[2]); $formatted[$this->_strip($matches[3])] = $matches[2];
} else { } else {
$address = $this->_strip($address); $address = $this->_strip($address);
$formatted[$address] = $address; $formatted[$address] = $address;

View file

@ -868,4 +868,22 @@ HTMLBLOC;
$this->assertNotRegExp('/Message-ID:/', $result); $this->assertNotRegExp('/Message-ID:/', $result);
} }
/**
* Make sure from/to are not double encoded when UTF-8 is present
*/
public function testEncodingFrom() {
$this->Controller->EmailTest->to = 'Teßt <test@example.com>';
$this->Controller->EmailTest->from = 'Teßt <test@example.com>';
$this->Controller->EmailTest->subject = 'Cake Debug Test';
$this->Controller->EmailTest->replyTo = 'noreply@example.com';
$this->Controller->EmailTest->template = null;
$this->Controller->EmailTest->delivery = 'DebugComp';
$this->assertTrue($this->Controller->EmailTest->send('This is the body of the message'));
$result = DebugCompTransport::$lastEmail;
$this->assertContains('From: =?UTF-8?B?VGXDn3Qg?= <test@example.com>', $result);
$this->assertContains('To: =?UTF-8?B?VGXDn3Qg?= <test@example.com>', $result);
}
} }

View file

@ -76,6 +76,29 @@ class CakeTestSuiteTest extends CakeTestCase {
$suite->addTestDirectoryRecursive($Folder->pwd()); $suite->addTestDirectoryRecursive($Folder->pwd());
$Folder->delete();
}
/**
* testAddTestDirectoryRecursiveWithNonPhp
*
* @return void
*/
public function testAddTestDirectoryRecursiveWithNonPhp() {
$this->skipIf(!is_writeable(TMP), 'Cant addTestDirectoryRecursiveWithNonPhp unless the tmp folder is writable.');
$Folder = new Folder(TMP . 'MyTestFolder', true, 0777);
touch($Folder->path . DS . 'BackupTest.php~');
touch($Folder->path . DS . 'SomeNotesTest.txt');
touch($Folder->path . DS . 'NotHiddenTest.php');
$suite = $this->getMock('CakeTestSuite', array('addTestFile'));
$suite
->expects($this->exactly(1))
->method('addTestFile');
$suite->addTestDirectoryRecursive($Folder->pwd());
$Folder->delete(); $Folder->delete();
} }
} }

View file

@ -108,6 +108,7 @@ class InflectorTest extends CakeTestCase {
$this->assertEquals(Inflector::singularize('cafes'), 'cafe'); $this->assertEquals(Inflector::singularize('cafes'), 'cafe');
$this->assertEquals(Inflector::singularize('roofs'), 'roof'); $this->assertEquals(Inflector::singularize('roofs'), 'roof');
$this->assertEquals(Inflector::singularize('foes'), 'foe'); $this->assertEquals(Inflector::singularize('foes'), 'foe');
$this->assertEquals(Inflector::singularize('databases'), 'database');
$this->assertEquals(Inflector::singularize(''), ''); $this->assertEquals(Inflector::singularize(''), '');
} }

View file

@ -37,7 +37,9 @@ class CakeTestSuite extends PHPUnit_Framework_TestSuite {
list($dirs, $files) = $Folder->read(true, true, true); list($dirs, $files) = $Folder->read(true, true, true);
foreach ($files as $file) { foreach ($files as $file) {
$this->addTestFile($file); if (substr($file, -4) === '.php') {
$this->addTestFile($file);
}
} }
} }
@ -52,7 +54,9 @@ class CakeTestSuite extends PHPUnit_Framework_TestSuite {
$files = $Folder->tree(null, true, 'files'); $files = $Folder->tree(null, true, 'files');
foreach ($files as $file) { foreach ($files as $file) {
$this->addTestFile($file); if (substr($file, -4) === '.php') {
$this->addTestFile($file);
}
} }
} }

View file

@ -124,7 +124,7 @@ class Inflector {
'/(drive)s$/i' => '\1', '/(drive)s$/i' => '\1',
'/([^fo])ves$/i' => '\1fe', '/([^fo])ves$/i' => '\1fe',
'/(^analy)ses$/i' => '\1sis', '/(^analy)ses$/i' => '\1sis',
'/(analy|ba|diagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i' => '\1\2sis', '/(analy|diagno|^ba|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i' => '\1\2sis',
'/([ti])a$/i' => '\1um', '/([ti])a$/i' => '\1um',
'/(p)eople$/i' => '\1\2erson', '/(p)eople$/i' => '\1\2erson',
'/(m)en$/i' => '\1an', '/(m)en$/i' => '\1an',