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.
*
* App::build(array(
* 'Plugin' => array('/full/path/to/plugins/', '/next/full/path/to/plugins/'),
* 'Model' => array('/full/path/to/models/', '/next/full/path/to/models/'),
* 'View' => array('/full/path/to/views/', '/next/full/path/to/views/'),
* 'Controller' => array('/full/path/to/controllers/', '/next/full/path/to/controllers/'),
* 'Model/Datasource' => array('/full/path/to/datasources/', '/next/full/path/to/datasources/'),
* 'Model/Behavior' => array('/full/path/to/behaviors/', '/next/full/path/to/behaviors/'),
* 'Controller/Component' => array('/full/path/to/components/', '/next/full/path/to/components/'),
* 'View/Helper' => array('/full/path/to/helpers/', '/next/full/path/to/helpers/'),
* 'Vendor' => array('/full/path/to/vendors/', '/next/full/path/to/vendors/'),
* 'Console/Command' => array('/full/path/to/shells/', '/next/full/path/to/shells/'),
* 'Locale' => array('/full/path/to/locale/', '/next/full/path/to/locale/')
* 'Model' => array('/path/to/models', '/next/path/to/models'),
* 'Model/Behavior' => array('/path/to/behaviors', '/next/path/to/behaviors'),
* 'Model/Datasource' => array('/path/to/datasources', '/next/path/to/datasources'),
* 'Model/Datasource/Database' => array('/path/to/databases', '/next/path/to/database'),
* 'Model/Datasource/Session' => array('/path/to/sessions', '/next/path/to/sessions'),
* 'Controller' => array('/path/to/controllers', '/next/path/to/controllers'),
* 'Controller/Component' => array('/path/to/components', '/next/path/to/components'),
* 'Controller/Component/Auth' => array('/path/to/auths', '/next/path/to/auths'),
* 'Controller/Component/Acl' => array('/path/to/acls', '/next/path/to/acls'),
* 'View' => array('/path/to/views', '/next/path/to/views'),
* '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
*/
protected function _buildFiles() {
$paths = $this->_paths;
$paths[] = realpath(APP) . DS;
foreach ($this->_translations as $domain => $translations) {
foreach ($translations as $msgid => $details) {
$plural = $details['msgid_plural'];
@ -474,7 +476,7 @@ class ExtractTask extends AppShell {
$occurrences[] = $file . ':' . implode(';', $lines);
}
$occurrences = implode("\n#: ", $occurrences);
$header = '#: ' . str_replace($this->_paths, '', $occurrences) . "\n";
$header = '#: ' . str_replace($paths, '', $occurrences) . "\n";
if ($plural === false) {
$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.
*
* App::build(array(
* 'Plugin' => array('/full/path/to/plugins/', '/next/full/path/to/plugins/'),
* 'Model' => array('/full/path/to/models/', '/next/full/path/to/models/'),
* 'View' => array('/full/path/to/views/', '/next/full/path/to/views/'),
* 'Controller' => array('/full/path/to/controllers/', '/next/full/path/to/controllers/'),
* 'Model/Datasource' => array('/full/path/to/datasources/', '/next/full/path/to/datasources/'),
* 'Model/Behavior' => array('/full/path/to/behaviors/', '/next/full/path/to/behaviors/'),
* 'Controller/Component' => array('/full/path/to/components/', '/next/full/path/to/components/'),
* 'View/Helper' => array('/full/path/to/helpers/', '/next/full/path/to/helpers/'),
* 'Vendor' => array('/full/path/to/vendors/', '/next/full/path/to/vendors/'),
* 'Console/Command' => array('/full/path/to/shells/', '/next/full/path/to/shells/'),
* 'Locale' => array('/full/path/to/locale/', '/next/full/path/to/locale/')
* 'Model' => array('/path/to/models', '/next/path/to/models'),
* 'Model/Behavior' => array('/path/to/behaviors', '/next/path/to/behaviors'),
* 'Model/Datasource' => array('/path/to/datasources', '/next/path/to/datasources'),
* 'Model/Datasource/Database' => array('/path/to/databases', '/next/path/to/database'),
* 'Model/Datasource/Session' => array('/path/to/sessions', '/next/path/to/sessions'),
* 'Controller' => array('/path/to/controllers', '/next/path/to/controllers'),
* 'Controller/Component' => array('/path/to/components', '/next/path/to/components'),
* 'Controller/Component/Auth' => array('/path/to/auths', '/next/path/to/auths'),
* 'Controller/Component/Acl' => array('/path/to/acls', '/next/path/to/acls'),
* 'View' => array('/path/to/views', '/next/path/to/views'),
* '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(
'AssetDispatcher',
'CacheDispatcher'
));
));

View file

@ -420,31 +420,6 @@ class EmailComponent extends Component {
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
*
@ -455,7 +430,7 @@ class EmailComponent extends Component {
$formatted = array();
foreach ($addresses as $address) {
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 {
$address = $this->_strip($address);
$formatted[$address] = $address;

View file

@ -868,4 +868,22 @@ HTMLBLOC;
$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());
$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();
}
}

View file

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

View file

@ -37,7 +37,9 @@ class CakeTestSuite extends PHPUnit_Framework_TestSuite {
list($dirs, $files) = $Folder->read(true, true, true);
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');
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',
'/([^fo])ves$/i' => '\1fe',
'/(^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',
'/(p)eople$/i' => '\1\2erson',
'/(m)en$/i' => '\1an',