Permalink
Browse files

Merge branch '1.3' of github.com:cakephp/cakephp1x into 1.3

  • Loading branch information...
2 parents bb239e3 + c2bd871 commit bd485c77d35e1e2bb1c7f3b041f356e224b91927 @markstory markstory committed Apr 28, 2010
View
@@ -18,4 +18,5 @@
// @license MIT License (http://www.opensource.org/licenses/mit-license.php)
// +--------------------------------------------------------------------------------------------+ //
////////////////////////////////////////////////////////////////////////////////////////////////////
-1.3.0-RC4
+1.3.0
+
View
@@ -17,5 +17,5 @@
* @since CakePHP(tm) v 1.1.11.4062
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
-return $config['Cake.version'] = '1.3.0-RC4';
+return $config['Cake.version'] = '1.3.0';
?>
@@ -249,10 +249,10 @@ function read($options = array()) {
if (in_array($table, $currentTables)) {
$key = array_search($table, $currentTables);
- if (empty($tables[$Object->table])) {
- $tables[$Object->table] = $this->__columns($Object);
- $tables[$Object->table]['indexes'] = $db->index($Object);
- $tables[$Object->table]['tableParameters'] = $db->readTableParameters($table);
+ if (empty($tables[$table])) {
+ $tables[$table] = $this->__columns($Object);
+ $tables[$table]['indexes'] = $db->index($Object);
+ $tables[$table]['tableParameters'] = $db->readTableParameters($table);
unset($currentTables[$key]);
}
if (!empty($Object->hasAndBelongsToMany)) {
@@ -261,12 +261,12 @@ function read($options = array()) {
$class = $assocData['with'];
}
if (is_object($Object->$class)) {
- $table = $db->fullTableName($Object->$class, false);
- if (in_array($table, $currentTables)) {
+ $withTable = $db->fullTableName($Object->$class, false);
+ if (in_array($withTable, $currentTables)) {
$key = array_search($table, $currentTables);
- $tables[$Object->$class->table] = $this->__columns($Object->$class);
- $tables[$Object->$class->table]['indexes'] = $db->index($Object->$class);
- $tables[$Object->$class->table]['tableParameters'] = $db->readTableParameters($table);
+ $tables[$withTable] = $this->__columns($Object->$class);
+ $tables[$withTable]['indexes'] = $db->index($Object->$class);
+ $tables[$withTable]['tableParameters'] = $db->readTableParameters($withTable);
unset($currentTables[$key]);
}
}
View
@@ -1907,14 +1907,15 @@ function deleteAll($conditions, $cascade = true, $callbacks = false) {
if (!$cascade && !$callbacks) {
return $db->delete($this, $conditions);
} else {
- $ids = Set::extract(
- $this->find('all', array_merge(array(
- 'fields' => "{$this->alias}.{$this->primaryKey}",
- 'recursive' => 0), compact('conditions'))
- ),
- "{n}.{$this->alias}.{$this->primaryKey}"
+ $ids = $this->find('all', array_merge(array(
+ 'fields' => "{$this->alias}.{$this->primaryKey}",
+ 'recursive' => 0), compact('conditions'))
);
+ if ($ids === false) {
+ return false;
+ }
+ $ids = Set::extract($ids, "{n}.{$this->alias}.{$this->primaryKey}");
if (empty($ids)) {
return true;
}
@@ -21,7 +21,7 @@ if (Configure::read() == 0):
endif;
?>
<h2><?php echo sprintf(__('Release Notes for CakePHP %s.', true), Configure::version()); ?></h2>
-<a href="http://cakephp.lighthouseapp.com/projects/42648/changelog-1-3-0-RC4"><?php __('Read the changelog'); ?> </a>
+<a href="http://cakephp.lighthouseapp.com/projects/42648/changelog-1-3-0"><?php __('Read the changelog'); ?> </a>
<?php
if (Configure::read() > 0):
Debugger::checkSecurityKeys();
@@ -1366,6 +1366,11 @@ function testDispatch() {
$url = 'test_dispatch_pages/camelCased';
$controller = $Dispatcher->dispatch($url, array('return' => 1));
$this->assertEqual('TestDispatchPages', $controller->name);
+
+ $url = 'test_dispatch_pages/camelCased/something. .';
+ $controller = $Dispatcher->dispatch($url, array('return' => 1));
+ $this->assertEqual($controller->params['pass'][0], 'something. .', 'Period was chopped off. %s');
+
}
/**
@@ -449,6 +449,33 @@ class SchemaCrossDatabaseFixture extends CakeTestFixture {
}
/**
+ * SchemaPrefixAuthUser class
+ *
+ * @package cake
+ * @subpackage cake.tests.cases.libs.model
+ */
+class SchemaPrefixAuthUser extends CakeTestModel {
+/**
+ * name property
+ *
+ * @var string
+ */
+ var $name = 'SchemaPrefixAuthUser';
+/**
+ * table prefix
+ *
+ * @var string
+ */
+ var $tablePrefix = 'auth_';
+/**
+ * useTable
+ *
+ * @var string
+ */
+ var $useTable = 'users';
+}
+
+/**
* CakeSchemaTest
*
* @package cake
@@ -463,7 +490,7 @@ class CakeSchemaTest extends CakeTestCase {
* @access public
*/
var $fixtures = array(
- 'core.post', 'core.tag', 'core.posts_tag', 'core.test_plugin_comment',
+ 'core.post', 'core.tag', 'core.posts_tag', 'core.test_plugin_comment',
'core.datatype', 'core.auth_user', 'core.author',
'core.test_plugin_article', 'core.user', 'core.comment'
);
@@ -523,7 +550,6 @@ function testSchemaRead() {
$expected = array('comments', 'datatypes', 'posts', 'posts_tags', 'tags');
$this->assertEqual(array_keys($read['tables']), $expected);
-
foreach ($read['tables'] as $table => $fields) {
$this->assertEqual(array_keys($fields), array_keys($this->Schema->tables[$table]));
}
@@ -552,6 +578,25 @@ function testSchemaRead() {
}
/**
+ * test read() with tablePrefix properties.
+ *
+ * @return void
+ */
+ function testSchemaReadWithTablePrefix() {
+ $model =& new SchemaPrefixAuthUser();
+
+ $Schema =& new CakeSchema();
+ $read = $Schema->read(array(
+ 'connection' => 'test_suite',
+ 'name' => 'TestApp',
+ 'models' => array('SchemaPrefixAuthUser')
+ ));
+ unset($read['tables']['missing']);
+ $this->assertTrue(isset($read['tables']['auth_users']), 'auth_users key missing %s');
+
+ }
+
+/**
* test reading schema from plugins.
*
* @return void
@@ -575,7 +620,7 @@ function testSchemaReadWithPlugins() {
$this->assertTrue(isset($read['tables']['test_plugin_comments']));
$this->assertTrue(isset($read['tables']['posts']));
$this->assertEqual(count($read['tables']), 4);
-
+
App::build();
}
@@ -423,6 +423,12 @@ function testDeleteAll() {
$result = $TestModel->deleteAll(array('Article.user_id' => 999));
$this->assertTrue($result, 'deleteAll returned false when all no records matched conditions. %s');
+
+ $this->expectError();
+ ob_start();
+ $result = $TestModel->deleteAll(array('Article.non_existent_field' => 999));
+ ob_get_clean();
+ $this->assertFalse($result, 'deleteAll returned true when find query generated sql error. %s');
}
/**
@@ -1665,6 +1665,36 @@ function testPagesUrlParsing() {
}
/**
+ * test that requests with a trailing dot don't loose the do.
+ *
+ * @return void
+ */
+ function testParsingWithTrailingPeriod() {
+ Router::reload();
+ $result = Router::parse('/posts/view/something.');
+ $this->assertEqual($result['pass'][0], 'something.', 'Period was chopped off %s');
+
+ $result = Router::parse('/posts/view/something. . .');
+ $this->assertEqual($result['pass'][0], 'something. . .', 'Period was chopped off %s');
+ }
+
+/**
+ * test that requests with a trailing dot don't loose the do.
+ *
+ * @return void
+ */
+ function testParsingWithTrailingPeriodAndParseExtensions() {
+ Router::reload();
+ Router::parseExtensions('json');
+
+ $result = Router::parse('/posts/view/something.');
+ $this->assertEqual($result['pass'][0], 'something.', 'Period was chopped off %s');
+
+ $result = Router::parse('/posts/view/something. . .');
+ $this->assertEqual($result['pass'][0], 'something. . .', 'Period was chopped off %s');
+ }
+
+/**
* testParsingWithPrefixes method
*
* @access public
@@ -20,6 +20,10 @@
App::import('Core', array('Helper', 'AppHelper', 'ClassRegistry', 'Controller', 'Model'));
App::import('Helper', array('Html', 'Form'));
+if (!defined('FULL_BASE_URL')) {
+ define('FULL_BASE_URL', 'http://cakephp.org');
+}
+
/**
* TheHtmlTestController class
*
@@ -157,6 +161,10 @@ function testLink() {
$expected = array('a' => array('href' => '/home'), 'preg:/\/home/', '/a');
$this->assertTags($result, $expected);
+ $result = $this->Html->link('Posts', array('controller' => 'posts', 'action' => 'index', 'full_base' => true));
+ $expected = array('a' => array('href' => FULL_BASE_URL . '/posts'), 'Posts', '/a');
+ $this->assertTags($result, $expected);
+
$result = $this->Html->link('Home', '/home', array('confirm' => 'Are you sure you want to do this?'));
$expected = array(
'a' => array('href' => '/home', 'onclick' => 'return confirm(&#039;Are you sure you want to do this?&#039;);'),
@@ -358,18 +366,18 @@ function testImageTagWithTheme() {
$webroot = $this->Html->webroot;
$this->Html->webroot = '/testing/';
$result = $this->Html->image('__cake_test_image.gif');
-
+
$this->assertTags($result, array(
'img' => array(
'src' => 'preg:/\/testing\/theme\/test_theme\/img\/__cake_test_image\.gif\?\d+/',
'alt' => ''
)));
$this->Html->webroot = $webroot;
-
+
$dir =& new Folder(WWW_ROOT . 'theme' . DS . 'test_theme');
$dir->delete();
}
-
+
/**
* test theme assets in main webroot path
*
@@ -383,7 +391,7 @@ function testThemeAssetsInMainWebrootPath() {
));
$webRoot = Configure::read('App.www_root');
Configure::write('App.www_root', TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'webroot' . DS);
-
+
$webroot = $this->Html->webroot;
$this->Html->theme = 'test_theme';
$result = $this->Html->css('webroot_test');
@@ -399,7 +407,7 @@ function testThemeAssetsInMainWebrootPath() {
'link' => array('rel' => 'stylesheet', 'type' => 'text/css', 'href' => 'preg:/.*theme\/test_theme\/css\/theme_webroot\.css/')
);
$this->assertTags($result, $expected);
-
+
Configure::write('App.www_root', $webRoot);
}

0 comments on commit bd485c7

Please sign in to comment.