Merge branch '2.0' into 2.1

Conflicts:
	lib/Cake/View/ThemeView.php
This commit is contained in:
Ceeram 2012-01-26 21:40:18 +01:00
commit 7eda0affe3
8 changed files with 86 additions and 61 deletions

View file

@ -37,13 +37,13 @@ endif;
</p>
<p>
<?php
if (version_compare(PHP_VERSION, '5.2.6', '>=')):
if (version_compare(PHP_VERSION, '5.2.8', '>=')):
echo '<span class="notice success">';
echo __d('cake_dev', 'Your version of PHP is 5.2.6 or higher.');
echo __d('cake_dev', 'Your version of PHP is 5.2.8 or higher.');
echo '</span>';
else:
echo '<span class="notice">';
echo __d('cake_dev', 'Your version of PHP is too low. You need PHP 5.2.6 or higher to use CakePHP.');
echo __d('cake_dev', 'Your version of PHP is too low. You need PHP 5.2.8 or higher to use CakePHP.');
echo '</span>';
endif;
?>

View file

@ -13,13 +13,13 @@ endif;
?>
<p>
<?php
if (version_compare(PHP_VERSION, '5.2.6', '>=')):
if (version_compare(PHP_VERSION, '5.2.8', '>=')):
echo '<span class=\"notice success\">';
echo __d('cake_dev', 'Your version of PHP is 5.2.6 or higher.');
echo __d('cake_dev', 'Your version of PHP is 5.2.8 or higher.');
echo '</span>';
else:
echo '<span class=\"notice\">';
echo __d('cake_dev', 'Your version of PHP is too low. You need PHP 5.2.6 or higher to use CakePHP.');
echo __d('cake_dev', 'Your version of PHP is too low. You need PHP 5.2.8 or higher to use CakePHP.');
echo '</span>';
endif;
?>

View file

@ -1543,7 +1543,7 @@ class Model extends Object implements CakeEventListener {
* @param array $validate See $options param in Model::save(). Does not respect 'fieldList' key if passed
* @return boolean See Model::save()
* @see Model::save()
* @link http://book.cakephp.org/2.0/en/models/retrieving-your-data.html#model-read
* @link http://book.cakephp.org/2.0/en/models/saving-your-data.html#model-savefield-string-fieldname-string-fieldvalue-validate-false
*/
public function saveField($name, $value, $validate = false) {
$id = $this->id;

View file

@ -1109,6 +1109,9 @@ class CakeEmail {
$restore = mb_internal_encoding();
mb_internal_encoding($this->_appCharset);
}
if (strpos($text, ',') !== false) {
$text = '"' . $text . '"';
}
$return = mb_encode_mimeheader($text, $this->headerCharset, 'B');
if ($internalEncoding) {
mb_internal_encoding($restore);

View file

@ -24,62 +24,62 @@ require_once dirname(__FILE__) . DS . 'ModelTestBase.php';
*/
class ModelWriteTest extends BaseModelTest {
/**
* testInsertAnotherHabtmRecordWithSameForeignKey method
*
* @access public
* @return void
*/
public function testInsertAnotherHabtmRecordWithSameForeignKey() {
$this->loadFixtures('JoinA', 'JoinB', 'JoinAB', 'JoinC', 'JoinAC');
$TestModel = new JoinA();
/**
* testInsertAnotherHabtmRecordWithSameForeignKey method
*
* @access public
* @return void
*/
public function testInsertAnotherHabtmRecordWithSameForeignKey() {
$this->loadFixtures('JoinA', 'JoinB', 'JoinAB', 'JoinC', 'JoinAC');
$TestModel = new JoinA();
$result = $TestModel->JoinAsJoinB->findById(1);
$expected = array(
'JoinAsJoinB' => array(
'id' => 1,
'join_a_id' => 1,
'join_b_id' => 2,
'other' => 'Data for Join A 1 Join B 2',
'created' => '2008-01-03 10:56:33',
'updated' => '2008-01-03 10:56:33'
));
$this->assertEquals($expected, $result);
$TestModel->JoinAsJoinB->create();
$data = array(
$result = $TestModel->JoinAsJoinB->findById(1);
$expected = array(
'JoinAsJoinB' => array(
'id' => 1,
'join_a_id' => 1,
'join_b_id' => 1,
'other' => 'Data for Join A 1 Join B 1',
'created' => '2008-01-03 10:56:44',
'updated' => '2008-01-03 10:56:44'
);
$result = $TestModel->JoinAsJoinB->save($data);
$lastInsertId = $TestModel->JoinAsJoinB->getLastInsertID();
$data['id'] = $lastInsertId;
$this->assertEquals($result, array('JoinAsJoinB' => $data));
$this->assertTrue($lastInsertId != null);
'join_b_id' => 2,
'other' => 'Data for Join A 1 Join B 2',
'created' => '2008-01-03 10:56:33',
'updated' => '2008-01-03 10:56:33'
));
$this->assertEquals($expected, $result);
$result = $TestModel->JoinAsJoinB->findById(1);
$expected = array(
'JoinAsJoinB' => array(
'id' => 1,
'join_a_id' => 1,
'join_b_id' => 2,
'other' => 'Data for Join A 1 Join B 2',
'created' => '2008-01-03 10:56:33',
'updated' => '2008-01-03 10:56:33'
));
$this->assertEquals($expected, $result);
$TestModel->JoinAsJoinB->create();
$data = array(
'join_a_id' => 1,
'join_b_id' => 1,
'other' => 'Data for Join A 1 Join B 1',
'created' => '2008-01-03 10:56:44',
'updated' => '2008-01-03 10:56:44'
);
$result = $TestModel->JoinAsJoinB->save($data);
$lastInsertId = $TestModel->JoinAsJoinB->getLastInsertID();
$data['id'] = $lastInsertId;
$this->assertEquals($result, array('JoinAsJoinB' => $data));
$this->assertTrue($lastInsertId != null);
$updatedValue = 'UPDATED Data for Join A 1 Join B 2';
$TestModel->JoinAsJoinB->id = 1;
$result = $TestModel->JoinAsJoinB->saveField('other', $updatedValue, false);
$this->assertFalse(empty($result));
$result = $TestModel->JoinAsJoinB->findById(1);
$expected = array(
'JoinAsJoinB' => array(
'id' => 1,
'join_a_id' => 1,
'join_b_id' => 2,
'other' => 'Data for Join A 1 Join B 2',
'created' => '2008-01-03 10:56:33',
'updated' => '2008-01-03 10:56:33'
));
$this->assertEquals($expected, $result);
$result = $TestModel->JoinAsJoinB->findById(1);
$this->assertEquals($result['JoinAsJoinB']['other'], $updatedValue);
}
$updatedValue = 'UPDATED Data for Join A 1 Join B 2';
$TestModel->JoinAsJoinB->id = 1;
$result = $TestModel->JoinAsJoinB->saveField('other', $updatedValue, false);
$this->assertFalse(empty($result));
$result = $TestModel->JoinAsJoinB->findById(1);
$this->assertEquals($result['JoinAsJoinB']['other'], $updatedValue);
}
/**
* testSaveDateAsFirstEntry method
@ -611,12 +611,26 @@ class ModelWriteTest extends BaseModelTest {
$this->assertEquals($expected, $result);
$TestModel->recursive = -1;
$result = $TestModel->read(array('id', 'user_id', 'title', 'body'), 1);
$TestModel->read(array('id', 'user_id', 'title', 'body'), 1);
$TestModel->id = 1;
$result = $TestModel->saveField('title', '', true);
$this->assertFalse($result);
$TestModel->recursive = -1;
$TestModel->id = 1;
$result = $TestModel->saveField('user_id', 9999);
$this->assertTrue((bool)$result);
$result = $TestModel->read(array('id', 'user_id'), 1);
$expected = array('Article' => array(
'id' => '1',
'user_id' => '9999',
));
$this->assertEquals($expected, $result);
$this->loadFixtures('Node', 'Dependency');
$Node = new Node();
$Node->set('id', 1);

View file

@ -277,6 +277,14 @@ class CakeEmailTest extends CakeTestCase {
$expected = array('CakePHP <cake@cakephp.org>', 'Cake <php@cakephp.org>');
$this->assertSame($expected, $result);
$result = $this->CakeEmail->formatAddress(array('me@example.com' => 'Last, First'));
$expected = array('"Last, First" <me@example.com>');
$this->assertSame($expected, $result);
$result = $this->CakeEmail->formatAddress(array('me@example.com' => 'Last First'));
$expected = array('Last First <me@example.com>');
$this->assertSame($expected, $result);
$result = $this->CakeEmail->formatAddress(array('cake@cakephp.org' => 'ÄÖÜTest'));
$expected = array('=?UTF-8?B?w4TDlsOcVGVzdA==?= <cake@cakephp.org>');
$this->assertSame($expected, $result);

View file

@ -489,7 +489,7 @@ class HtmlHelper extends AppHelper {
*
* Add the script file to the `$scripts_for_layout` layout var:
*
* `$this->Html->script('styles.js', null, array('inline' => false));`
* `$this->Html->script('styles.js', array('inline' => false));`
*
* Add the script file to a custom block:
*

View file

@ -27,5 +27,5 @@ App::uses('View', 'View');
* @package Cake.View
*/
class ThemeView extends View {
}