Skip to content

Commit

Permalink
Merge branch '2.1' into 2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Apr 24, 2012
2 parents 74ee75b + 9e3fe63 commit b6de177
Show file tree
Hide file tree
Showing 9 changed files with 90 additions and 53 deletions.
29 changes: 18 additions & 11 deletions app/Config/bootstrap.php
Expand Up @@ -89,17 +89,24 @@
* 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'),
* ));
*
*/
Expand Down
4 changes: 3 additions & 1 deletion lib/Cake/Console/Command/Task/ExtractTask.php
Expand Up @@ -464,6 +464,8 @@ protected function _processValidationRules($field, $rules, $file, $domain) {
* @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'];
Expand All @@ -474,7 +476,7 @@ protected function _buildFiles() {
$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";
Expand Down
31 changes: 19 additions & 12 deletions lib/Cake/Console/Templates/skel/Config/bootstrap.php
Expand Up @@ -30,17 +30,24 @@
* 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'),
* ));
*
*/
Expand Down Expand Up @@ -83,4 +90,4 @@
Configure::write('Dispatcher.filters', array(
'AssetDispatcher',
'CacheDispatcher'
));
));
27 changes: 1 addition & 26 deletions lib/Cake/Controller/Component/EmailComponent.php
Expand Up @@ -420,31 +420,6 @@ protected function _findFiles($attachment) {
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
*
Expand All @@ -455,7 +430,7 @@ protected function _formatAddresses($addresses) {
$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;
Expand Down
18 changes: 18 additions & 0 deletions lib/Cake/Test/Case/Controller/Component/EmailComponentTest.php
Expand Up @@ -868,4 +868,22 @@ public function testMessageId() {
$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);
}

}
23 changes: 23 additions & 0 deletions lib/Cake/Test/Case/TestSuite/CakeTestSuiteTest.php
Expand Up @@ -76,6 +76,29 @@ public function testAddTestDirectoryRecursiveWithHidden() {

$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();
}
}
1 change: 1 addition & 0 deletions lib/Cake/Test/Case/Utility/InflectorTest.php
Expand Up @@ -108,6 +108,7 @@ public function testInflectingSingulars() {
$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(''), '');
}
Expand Down
8 changes: 6 additions & 2 deletions lib/Cake/TestSuite/CakeTestSuite.php
Expand Up @@ -37,7 +37,9 @@ public function addTestDirectory($directory = '.') {
list($dirs, $files) = $Folder->read(true, true, true);

foreach ($files as $file) {
$this->addTestFile($file);
if (substr($file, -4) === '.php') {
$this->addTestFile($file);
}
}
}

Expand All @@ -52,7 +54,9 @@ public function addTestDirectoryRecursive($directory = '.') {
$files = $Folder->tree(null, true, 'files');

foreach ($files as $file) {
$this->addTestFile($file);
if (substr($file, -4) === '.php') {
$this->addTestFile($file);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Utility/Inflector.php
Expand Up @@ -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',
Expand Down

0 comments on commit b6de177

Please sign in to comment.