Permalink
Browse files

Merge branch '2.1' into 2.2

  • Loading branch information...
2 parents 74ee75b + 9e3fe63 commit b6de177ffa4674f700229fa2ceb7c66def7632ab @markstory markstory committed Apr 24, 2012
View
@@ -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'),
* ));
*
*/
@@ -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'];
@@ -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";
@@ -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'),
* ));
*
*/
@@ -83,4 +90,4 @@
Configure::write('Dispatcher.filters', array(
'AssetDispatcher',
'CacheDispatcher'
-));
+));
@@ -421,31 +421,6 @@ protected function _findFiles($attachment) {
}
/**
- * 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
*
* @param array $addresses
@@ -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;
@@ -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);
+ }
+
}
@@ -78,4 +78,27 @@ public function testAddTestDirectoryRecursiveWithHidden() {
$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();
+ }
}
@@ -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(''), '');
}
@@ -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);
+ }
}
}
@@ -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);
+ }
}
}
@@ -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',

0 comments on commit b6de177

Please sign in to comment.