diff --git a/cake/console/templates/skel/config/bootstrap.php b/cake/console/templates/skel/config/bootstrap.php index 59423e767..861972966 100644 --- a/cake/console/templates/skel/config/bootstrap.php +++ b/cake/console/templates/skel/config/bootstrap.php @@ -44,8 +44,8 @@ /** * As of 1.3, additional rules for the inflector are added below * - * Inflector::rule('singular', array('rules' => array(), irregular' => array(), 'uninflected' => array())); - * Inflector::rule('plural', array('rules' => array(), 'irregular' => array(), 'uninflected' => array())); + * Inflector::rules('singular', array('rules' => array(), 'irregular' => array(), 'uninflected' => array())); + * Inflector::rules('plural', array('rules' => array(), 'irregular' => array(), 'uninflected' => array())); * */ ?> \ No newline at end of file diff --git a/cake/console/templates/skel/webroot/css/cake.generic.css b/cake/console/templates/skel/webroot/css/cake.generic.css index 4f6f5a2cd..4d0161f8c 100644 --- a/cake/console/templates/skel/webroot/css/cake.generic.css +++ b/cake/console/templates/skel/webroot/css/cake.generic.css @@ -79,7 +79,7 @@ ul, li { } #header h1 { line-height:20px; - background: #003d4c url('../img/cake.icon.png') no-repeat left; + background: #003d4c url('../img/cake.icon.gif') no-repeat left; color: #fff; padding: 0px 30px; } @@ -532,4 +532,4 @@ div.code-coverage-results span.result-ok { } div.code-coverage-results span.result-good { color: #0a0; -} \ No newline at end of file +} diff --git a/cake/libs/controller/components/email.php b/cake/libs/controller/components/email.php index b04c8343d..32ae8defb 100755 --- a/cake/libs/controller/components/email.php +++ b/cake/libs/controller/components/email.php @@ -920,8 +920,11 @@ class EmailComponent extends Object{ $fm .= sprintf('%s%3$s%3$s%s', 'Message:', $message, $nl); $fm .= ''; - $this->Controller->Session->setFlash($fm, 'default', null, 'email'); - return true; + if (isset($this->Controller->Session)) { + $this->Controller->Session->setFlash($fm, 'default', null, 'email'); + return true; + } + return $fm; } } diff --git a/cake/libs/inflector.php b/cake/libs/inflector.php index a5f341a6c..3c99bf9fd 100644 --- a/cake/libs/inflector.php +++ b/cake/libs/inflector.php @@ -192,7 +192,7 @@ class Inflector { '/Ð|Ď|Đ/' => 'D', '/ð|ď|đ/' => 'd', '/È|É|Ê|Ë|Ē|Ĕ|Ė|Ę|Ě/' => 'E', - '/è|é|ê|ë|ē|ĕ|ė|ę|ě|&/' => 'e', + '/è|é|ê|ë|ē|ĕ|ė|ę|ě/' => 'e', '/Ĝ|Ğ|Ġ|Ģ/' => 'G', '/ĝ|ğ|ġ|ģ/' => 'g', '/Ĥ|Ħ/' => 'H', diff --git a/cake/libs/model/behaviors/containable.php b/cake/libs/model/behaviors/containable.php index 170c78f5f..c3a5da7fa 100644 --- a/cake/libs/model/behaviors/containable.php +++ b/cake/libs/model/behaviors/containable.php @@ -187,7 +187,7 @@ class ContainableBehavior extends ModelBehavior { foreach (array('hasOne', 'belongsTo') as $type) { if (!empty($Model->{$type})) { foreach ($Model->{$type} as $assoc => $data) { - if (!empty($data['fields'])) { + if ($Model->useDbConfig == $Model->{$assoc}->useDbConfig && !empty($data['fields'])) { foreach ((array) $data['fields'] as $field) { $query['fields'][] = (strpos($field, '.') === false ? $assoc . '.' : '') . $field; } @@ -195,15 +195,24 @@ class ContainableBehavior extends ModelBehavior { } } } + if (!empty($mandatory[$Model->alias])) { foreach ($mandatory[$Model->alias] as $field) { if ($field == '--primaryKey--') { $field = $Model->primaryKey; } else if (preg_match('/^.+\.\-\-[^-]+\-\-$/', $field)) { list($modelName, $field) = explode('.', $field); - $field = $modelName . '.' . (($field === '--primaryKey--') ? $Model->$modelName->primaryKey : $field); + if ($Model->useDbConfig == $Model->{$modelName}->useDbConfig) { + $field = $modelName . '.' . ( + ($field === '--primaryKey--') ? $Model->$modelName->primaryKey : $field + ); + } else { + $field = null; + } + } + if ($field !== null) { + $query['fields'][] = $field; } - $query['fields'][] = $field; } } $query['fields'] = array_unique($query['fields']); diff --git a/cake/libs/model/model.php b/cake/libs/model/model.php index bdecc9f5a..f017c7bc5 100644 --- a/cake/libs/model/model.php +++ b/cake/libs/model/model.php @@ -1893,7 +1893,7 @@ class Model extends Overloadable { * * @param mixed $conditions Conditions to match * @param boolean $cascade Set to true to delete records that depend on this record - * @param boolean $callbacks Run callbacks (not being used) + * @param boolean $callbacks Run callbacks * @return boolean True on success, false on failure * @access public * @link http://book.cakephp.org/view/1038/deleteAll diff --git a/cake/libs/view/helpers/form.php b/cake/libs/view/helpers/form.php index 939aa4962..36d6939ce 100755 --- a/cake/libs/view/helpers/form.php +++ b/cake/libs/view/helpers/form.php @@ -216,8 +216,9 @@ class FormHelper extends AppHelper { $object =& $this->_introspectModel($model); $this->setEntity($model . '.', true); - if (isset($this->fieldset[$this->model()]['key'])) { - $data = $this->fieldset[$this->model()]; + $modelEntity = $this->model(); + if (isset($this->fieldset[$modelEntity]['key'])) { + $data = $this->fieldset[$modelEntity]; $recordExists = ( isset($this->data[$model]) && !empty($this->data[$model][$data['key']]) diff --git a/cake/libs/view/media.php b/cake/libs/view/media.php index 666c87516..e85924b64 100644 --- a/cake/libs/view/media.php +++ b/cake/libs/view/media.php @@ -283,4 +283,4 @@ class MediaView extends View { @ob_flush(); } } -?> +?> \ No newline at end of file diff --git a/cake/tests/cases/libs/cache/memcache.test.php b/cake/tests/cases/libs/cache/memcache.test.php index dca22d482..5b7c6bd35 100644 --- a/cake/tests/cases/libs/cache/memcache.test.php +++ b/cake/tests/cases/libs/cache/memcache.test.php @@ -52,7 +52,11 @@ class MemcacheEngineTest extends CakeTestCase { function setUp() { $this->_cacheDisable = Configure::read('Cache.disable'); Configure::write('Cache.disable', false); - Cache::config('memcache', array('engine' => 'Memcache', 'prefix' => 'cake_')); + Cache::config('memcache', array( + 'engine' => 'Memcache', + 'prefix' => 'cake_', + 'duration' => 3600 + )); } /** @@ -266,5 +270,41 @@ class MemcacheEngineTest extends CakeTestCase { $result = Cache::read('test_increment'); $this->assertEqual(8, $result); } + +/** + * test that configurations don't conflict, when a file engine is declared after a memcache one. + * + * @return void + */ + function testConfigurationConflict() { + Cache::config('long_memcache', array( + 'engine' => 'Memcache', + 'duration'=> '+2 seconds', + 'servers' => array('127.0.0.1:11211'), + )); + Cache::config('short_memcache', array( + 'engine' => 'Memcache', + 'duration'=> '+1 seconds', + 'servers' => array('127.0.0.1:11211'), + )); + Cache::config('some_file', array('engine' => 'File')); + + $this->assertTrue(Cache::write('duration_test', 'yay', 'long_memcache')); + $this->assertTrue(Cache::write('short_duration_test', 'boo', 'short_memcache')); + + $this->assertEqual(Cache::read('duration_test', 'long_memcache'), 'yay', 'Value was not read %s'); + $this->assertEqual(Cache::read('short_duration_test', 'short_memcache'), 'boo', 'Value was not read %s'); + + sleep(1); + $this->assertEqual(Cache::read('duration_test', 'long_memcache'), 'yay', 'Value was not read %s'); + + sleep(2); + $this->assertFalse(Cache::read('short_duration_test', 'short_memcache'), 'Cache was not invalidated %s'); + $this->assertFalse(Cache::read('duration_test', 'long_memcache'), 'Value did not expire %s'); + + Cache::delete('duration_test', 'long_memcache'); + Cache::delete('short_duration_test', 'short_memcache'); + } + } ?> \ No newline at end of file diff --git a/cake/tests/cases/libs/controller/components/email.test.php b/cake/tests/cases/libs/controller/components/email.test.php index b1ee3a5c4..210c5eeef 100755 --- a/cake/tests/cases/libs/controller/components/email.test.php +++ b/cake/tests/cases/libs/controller/components/email.test.php @@ -583,7 +583,34 @@ TEXTBLOC; $this->assertPattern('/Content-Type: text\/plain; charset=UTF-8\n/', $result); $this->assertPattern('/Content-Transfer-Encoding: 7bitParameters:\n/', $result); $this->assertPattern('/This is the body of the message/', $result); + } +/** + * test send with delivery = debug and not using sessions. + * + * @return void + */ + function testSendDebugWithNoSessions() { + $session =& $this->Controller->Session; + unset($this->Controller->Session); + $this->Controller->EmailTest->to = 'postmaster@localhost'; + $this->Controller->EmailTest->from = 'noreply@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 = 'debug'; + $result = $this->Controller->EmailTest->send('This is the body of the message'); + + $this->assertPattern('/To: postmaster@localhost\n/', $result); + $this->assertPattern('/Subject: Cake Debug Test\n/', $result); + $this->assertPattern('/Reply-To: noreply@example.com\n/', $result); + $this->assertPattern('/From: noreply@example.com\n/', $result); + $this->assertPattern('/X-Mailer: CakePHP Email Component\n/', $result); + $this->assertPattern('/Content-Type: text\/plain; charset=UTF-8\n/', $result); + $this->assertPattern('/Content-Transfer-Encoding: 7bitParameters:\n/', $result); + $this->assertPattern('/This is the body of the message/', $result); + $this->Controller->Session = $session; } /** diff --git a/cake/tests/cases/libs/model/behaviors/containable.test.php b/cake/tests/cases/libs/model/behaviors/containable.test.php index 9cf034dcd..14897039c 100644 --- a/cake/tests/cases/libs/model/behaviors/containable.test.php +++ b/cake/tests/cases/libs/model/behaviors/containable.test.php @@ -3593,6 +3593,50 @@ class ContainableBehaviorTest extends CakeTestCase { $this->assertEqual($expected, $this->Article->hasAndBelongsToMany); } +/** + * test that autoFields doesn't splice in fields from other databases. + * + * @return void + */ + function testAutoFieldsWithMultipleDatabases() { + $config = new DATABASE_CONFIG(); + + $skip = $this->skipIf( + !isset($config->test) || !isset($config->test2), + '%s Primary and secondary test databases not configured, skipping cross-database ' + .'join tests.' + .' To run these tests, you must define $test and $test2 in your database configuration.' + ); + if ($skip) { + return; + } + + $db =& ConnectionManager::getDataSource('test2'); + $this->_fixtures[$this->_fixtureClassMap['User']]->create($db); + $this->_fixtures[$this->_fixtureClassMap['User']]->insert($db); + + $this->Article->User->setDataSource('test2'); + + $result = $this->Article->find('all', array( + 'fields' => array('Article.title'), + 'contain' => array('User') + )); + $this->assertTrue(isset($result[0]['Article'])); + $this->assertTrue(isset($result[0]['User'])); + + $this->_fixtures[$this->_fixtureClassMap['User']]->drop($db); + } +/** + * test that autoFields doesn't splice in columns that aren't part of the join. + * + * @return void + */ + function testAutoFieldsWithRecursiveNegativeOne() { + $this->Article->recursive = -1; + $result = $this->Article->field('title', array('Article.title' => 'First Article')); + $this->assertNoErrors(); + $this->assertEqual($result, 'First Article', 'Field is wrong'); + } /** * containments method * diff --git a/cake/tests/cases/libs/view/helpers/javascript.test.php b/cake/tests/cases/libs/view/helpers/javascript.test.php index 22b570b8c..cec0399a0 100644 --- a/cake/tests/cases/libs/view/helpers/javascript.test.php +++ b/cake/tests/cases/libs/view/helpers/javascript.test.php @@ -441,6 +441,22 @@ class JavascriptTest extends CakeTestCase { $result = $this->Javascript->object($object, array('quoteKeys' => false, 'stringKeys' => array('key1', 'key3'))); $this->assertEqual($result, $expected); + $expected = '{?Object?:{?key1?:"val1",?key2?:"val2",?key3?:"val3"}}'; + $result = $this->Javascript->object($object, array('q' => '?')); + $this->assertEqual($result, $expected); + + $expected = '{?Object?:{?key1?:"val1",?key2?:val2,?key3?:"val3"}}'; + $result = $this->Javascript->object($object, array( + 'q' => '?', 'stringKeys' => array('key3', 'key1') + )); + $this->assertEqual($result, $expected); + + $expected = '{?Object?:{?key1?:val1,?key2?:"val2",?key3?:val3}}'; + $result = $this->Javascript->object($object, array( + 'q' => '?', 'stringKeys' => array('key3', 'key1'), 'quoteKeys' => false + )); + $this->assertEqual($result, $expected); + $this->Javascript->useNative = $oldNative; } diff --git a/cake/tests/cases/libs/view/helpers/time.test.php b/cake/tests/cases/libs/view/helpers/time.test.php index 47c26c169..2e8274158 100644 --- a/cake/tests/cases/libs/view/helpers/time.test.php +++ b/cake/tests/cases/libs/view/helpers/time.test.php @@ -782,4 +782,4 @@ class TimeHelperTest extends CakeTestCase { $this->assertEqual($this->Time->format($time, '%c'), $this->Time->i18nFormat($time, '%c')); } } -?> +?> \ No newline at end of file diff --git a/cake/tests/cases/libs/view/media.test.php b/cake/tests/cases/libs/view/media.test.php index 76d3aeb3d..23c6f7d04 100644 --- a/cake/tests/cases/libs/view/media.test.php +++ b/cake/tests/cases/libs/view/media.test.php @@ -178,4 +178,4 @@ class MediaViewTest extends CakeTestCase { $this->assertFalse($result); } } -?> +?> \ No newline at end of file