Merge branch 'master' into 2.4

This commit is contained in:
ADmad 2013-06-09 18:08:32 +05:30
commit 636cc8c103
49 changed files with 496 additions and 746 deletions

View file

@ -4,6 +4,7 @@ php:
- 5.2
- 5.3
- 5.4
- 5.5
env:
- DB=mysql
@ -25,8 +26,8 @@ before_script:
- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE SCHEMA test3;' -U postgres -d cakephp_test; fi"
- chmod -R 777 ./app/tmp
- sudo apt-get install lighttpd
- pear channel-discover pear.cakephp.org
- pear install --alldeps cakephp/CakePHP_CodeSniffer
- sh -c "if [ '$PHPCS' = '1' ]; then pear channel-discover pear.cakephp.org; fi"
- sh -c "if [ '$PHPCS' = '1' ]; then pear install --alldeps cakephp/CakePHP_CodeSniffer; fi"
- phpenv rehash
- set +H
- echo "<?php
@ -113,4 +114,4 @@ script:
- sh -c "if [ '$PHPCS' != '1' ]; then ./lib/Cake/Console/cake test core AllTests --stderr; else phpcs -p --extensions=php --standard=CakePHP ./lib/Cake; fi"
notifications:
email: false
email: false

View file

@ -365,7 +365,8 @@ class FileEngine extends CacheEngine {
$contents = new RecursiveIteratorIterator($directoryIterator, RecursiveIteratorIterator::CHILD_FIRST);
foreach ($contents as $object) {
$containsGroup = strpos($object->getPathName(), DS . $group . DS) !== false;
if ($object->isFile() && $containsGroup) {
$hasPrefix = strpos($object->getBaseName(), $this->settings['prefix']) === 0;
if ($object->isFile() && $containsGroup && $hasPrefix) {
unlink($object->getPathName());
}
}

View file

@ -235,7 +235,7 @@ class FixtureTask extends BakeTask {
$this->_Schema = new CakeSchema();
$data = $this->_Schema->read(array('models' => false, 'connection' => $this->connection));
if (!isset($data['tables'][$useTable])) {
$this->err('Could not find your selected table ' . $useTable);
$this->error('Could not find your selected table ' . $useTable);
return false;
}

View file

@ -171,8 +171,8 @@ class TestShell extends Shell {
*/
public function initialize() {
$this->_dispatcher = new CakeTestSuiteDispatcher();
$sucess = $this->_dispatcher->loadTestFramework();
if (!$sucess) {
$success = $this->_dispatcher->loadTestFramework();
if (!$success) {
throw new Exception(__d('cake_dev', 'Please install PHPUnit framework <info>(http://www.phpunit.de)</info>'));
}
}

View file

@ -387,20 +387,20 @@ class CookieComponent extends Component {
* @return integer Unix timestamp
*/
protected function _expire($expires = null) {
$now = time();
if (is_null($expires)) {
return $this->_expires;
}
$this->_reset = $this->_expires;
if (!$expires) {
return $this->_expires = 0;
}
$now = new DateTime();
if (is_int($expires) || is_numeric($expires)) {
return $this->_expires = $now + intval($expires);
return $this->_expires = $now->format('U') + intval($expires);
}
return $this->_expires = strtotime($expires, $now);
$now->modify($expires);
return $this->_expires = $now->format('U');
}
/**

View file

@ -417,7 +417,7 @@ class TranslateBehavior extends ModelBehavior {
}
unset($this->runtime[$Model->alias]['beforeValidate'], $this->runtime[$Model->alias]['beforeSave']);
$conditions = array('model' => $Model->alias, 'foreign_key' => $Model->id);
$conditions = array('model' => $Model->name, 'foreign_key' => $Model->id);
$RuntimeModel = $this->translateModel($Model);
if ($created) {
@ -502,7 +502,7 @@ class TranslateBehavior extends ModelBehavior {
*/
public function afterDelete(Model $Model) {
$RuntimeModel = $this->translateModel($Model);
$conditions = array('model' => $Model->alias, 'foreign_key' => $Model->id);
$conditions = array('model' => $Model->name, 'foreign_key' => $Model->id);
$RuntimeModel->deleteAll($conditions);
}
@ -611,7 +611,7 @@ class TranslateBehavior extends ModelBehavior {
}
}
$associations[$association] = array_merge($default, array('conditions' => array(
'model' => $Model->alias,
'model' => $Model->name,
$RuntimeModel->displayField => $field
)));
}

View file

@ -443,7 +443,11 @@ class FileEngineTest extends CakeTestCase {
* @return void
*/
public function testGroupDelete() {
Cache::config('file_groups', array('engine' => 'File', 'duration' => 3600, 'groups' => array('group_a', 'group_b')));
Cache::config('file_groups', array(
'engine' => 'File',
'duration' => 3600,
'groups' => array('group_a', 'group_b')
));
$this->assertTrue(Cache::write('test_groups', 'value', 'file_groups'));
$this->assertEquals('value', Cache::read('test_groups', 'file_groups'));
$this->assertTrue(Cache::delete('test_groups', 'file_groups'));
@ -459,24 +463,29 @@ class FileEngineTest extends CakeTestCase {
public function testGroupClear() {
Cache::config('file_groups', array('engine' => 'File', 'duration' => 3600, 'groups' => array('group_a', 'group_b')));
Cache::config('file_groups2', array('engine' => 'File', 'duration' => 3600, 'groups' => array('group_b')));
Cache::config('file_groups3', array('engine' => 'File', 'duration' => 3600, 'groups' => array('group_a')));
Cache::config('file_groups3', array(
'engine' => 'File',
'duration' => 3600,
'groups' => array('group_b'),
'prefix' => 'leading_',
));
$this->assertTrue(Cache::write('test_groups', 'value', 'file_groups'));
$this->assertTrue(Cache::write('test_groups2', 'value', 'file_groups2'));
$this->assertTrue(Cache::write('test_groups3', 'value', 'file_groups3'));
$this->assertTrue(Cache::write('test_groups2', 'value 2', 'file_groups2'));
$this->assertTrue(Cache::write('test_groups3', 'value 3', 'file_groups3'));
$this->assertTrue(Cache::clearGroup('group_a', 'file_groups'));
$this->assertTrue(Cache::clearGroup('group_b', 'file_groups'));
$this->assertFalse(Cache::read('test_groups', 'file_groups'));
$this->assertEquals('value', Cache::read('test_groups2', 'file_groups2'));
$this->assertFalse(Cache::read('test_groups3', 'file_groups3'));
$this->assertFalse(Cache::read('test_groups2', 'file_groups2'));
$this->assertEquals('value 3', Cache::read('test_groups3', 'file_groups3'));
$this->assertTrue(Cache::write('test_groups4', 'value', 'file_groups'));
$this->assertTrue(Cache::write('test_groups5', 'value', 'file_groups2'));
$this->assertTrue(Cache::write('test_groups6', 'value', 'file_groups3'));
$this->assertTrue(Cache::write('test_groups5', 'value 2', 'file_groups2'));
$this->assertTrue(Cache::write('test_groups6', 'value 3', 'file_groups3'));
$this->assertTrue(Cache::clearGroup('group_b', 'file_groups'));
$this->assertFalse(Cache::read('test_groups4', 'file_groups'));
$this->assertFalse(Cache::read('test_groups5', 'file_groups2'));
$this->assertEquals('value', Cache::read('test_groups6', 'file_groups3'));
$this->assertEquals('value 3', Cache::read('test_groups6', 'file_groups3'));
}
}

View file

@ -26,7 +26,7 @@ App::uses('RedisEngine', 'Cache/Engine');
*
* @package Cake.Test.Case.Cache.Engine
*/
class RegisEngineTest extends CakeTestCase {
class RedisEngineTest extends CakeTestCase {
/**
* setUp method

View file

@ -31,9 +31,6 @@ App::uses('Controller', 'Controller');
if (!class_exists('UsersController')) {
class UsersController extends Controller {
public $name = 'Users';
}
}

View file

@ -32,17 +32,10 @@ App::uses('SchemaShell', 'Console/Command');
*/
class SchemaShellTestSchema extends CakeSchema {
/**
* name property
*
* @var string 'MyApp'
*/
public $name = 'SchemaShellTest';
/**
* connection property
*
* @var string 'test'
* @var string
*/
public $connection = 'test';

View file

@ -45,8 +45,6 @@ if (!$imported) {
*/
class BakeArticle extends Model {
public $name = 'BakeArticle';
public $hasMany = array('BakeComment');
public $hasAndBelongsToMany = array('BakeTag');

View file

@ -36,13 +36,6 @@ App::uses('Model', 'Model');
*/
class TestTaskArticle extends Model {
/**
* Model name
*
* @var string
*/
public $name = 'TestTaskArticle';
/**
* Table name to use
*
@ -109,13 +102,6 @@ class TestTaskArticle extends Model {
*/
class TestTaskTag extends Model {
/**
* Model name
*
* @var string
*/
public $name = 'TestTaskTag';
/**
* Table name
*
@ -153,13 +139,6 @@ class TestTaskAppModel extends Model {
*/
class TestTaskComment extends TestTaskAppModel {
/**
* Model name
*
* @var string
*/
public $name = 'TestTaskComment';
/**
* Table name
*
@ -187,13 +166,6 @@ class TestTaskComment extends TestTaskAppModel {
*/
class TestTaskCommentsController extends Controller {
/**
* Controller Name
*
* @var string
*/
public $name = 'TestTaskComments';
/**
* Models to use
*

View file

@ -39,13 +39,6 @@ App::uses('Controller', 'Controller');
*/
class ViewTaskComment extends Model {
/**
* Model name
*
* @var string
*/
public $name = 'ViewTaskComment';
/**
* Table name
*
@ -73,13 +66,6 @@ class ViewTaskComment extends Model {
*/
class ViewTaskArticle extends Model {
/**
* Model name
*
* @var string
*/
public $name = 'ViewTaskArticle';
/**
* Table name
*
@ -95,13 +81,6 @@ class ViewTaskArticle extends Model {
*/
class ViewTaskCommentsController extends Controller {
/**
* Controller name
*
* @var string
*/
public $name = 'ViewTaskComments';
/**
* Testing public controller action
*
@ -127,13 +106,6 @@ class ViewTaskCommentsController extends Controller {
*/
class ViewTaskArticlesController extends Controller {
/**
* Controller name
*
* @var string
*/
public $name = 'ViewTaskArticles';
/**
* Test public controller action
*

View file

@ -35,7 +35,7 @@ class AclNodeTwoTestBase extends AclNode {
/**
* useDbConfig property
*
* @var string 'test'
* @var string
*/
public $useDbConfig = 'test';
@ -57,14 +57,14 @@ class AroTwoTest extends AclNodeTwoTestBase {
/**
* name property
*
* @var string 'AroTwoTest'
* @var string
*/
public $name = 'AroTwoTest';
/**
* useTable property
*
* @var string 'aro_twos'
* @var string
*/
public $useTable = 'aro_twos';
@ -86,14 +86,14 @@ class AcoTwoTest extends AclNodeTwoTestBase {
/**
* name property
*
* @var string 'AcoTwoTest'
* @var string
*/
public $name = 'AcoTwoTest';
/**
* useTable property
*
* @var string 'aco_twos'
* @var string
*/
public $useTable = 'aco_twos';
@ -115,14 +115,14 @@ class PermissionTwoTest extends Permission {
/**
* name property
*
* @var string 'PermissionTwoTest'
* @var string
*/
public $name = 'PermissionTwoTest';
/**
* useTable property
*
* @var string 'aros_aco_twos'
* @var string
*/
public $useTable = 'aros_aco_twos';

View file

@ -153,7 +153,7 @@ class BasicAuthenticateTest extends CakeTestCase {
}
/**
* test authenticate sucesss
* test authenticate success
*
* @return void
*/

View file

@ -59,17 +59,10 @@ class TestAuthComponent extends AuthComponent {
*/
class AuthUser extends CakeTestModel {
/**
* name property
*
* @var string 'AuthUser'
*/
public $name = 'AuthUser';
/**
* useDbConfig property
*
* @var string 'test'
* @var string
*/
public $useDbConfig = 'test';
@ -82,13 +75,6 @@ class AuthUser extends CakeTestModel {
*/
class AuthTestController extends Controller {
/**
* name property
*
* @var string 'AuthTest'
*/
public $name = 'AuthTest';
/**
* uses property
*
@ -203,13 +189,6 @@ class AuthTestController extends Controller {
*/
class AjaxAuthController extends Controller {
/**
* name property
*
* @var string 'AjaxAuth'
*/
public $name = 'AjaxAuth';
/**
* components property
*
@ -278,7 +257,7 @@ class AuthComponentTest extends CakeTestCase {
/**
* name property
*
* @var string 'Auth'
* @var string
*/
public $name = 'Auth';

View file

@ -201,6 +201,31 @@ class CookieComponentTest extends CakeTestCase {
$this->assertEquals('value', $result);
}
/**
* test write with distant future cookies
*
* @return void
*/
public function testWriteFarFuture() {
$this->Cookie->write('Testing', 'value', false, '+90 years');
$future = new DateTime('now');
$future->modify('+90 years');
$expected = array(
'name' => $this->Cookie->name . '[Testing]',
'value' => 'value',
'path' => '/',
'domain' => '',
'secure' => false,
'httpOnly' => false);
$result = $this->Controller->response->cookie($this->Cookie->name . '[Testing]');
$this->assertEquals($future->format('U'), $result['expire'], '', 3);
unset($result['expire']);
$this->assertEquals($expected, $result);
}
/**
* test write with httpOnly cookies
*

View file

@ -93,13 +93,6 @@ class DebugCompTransport extends AbstractTransport {
*/
class EmailTestController extends Controller {
/**
* name property
*
* @var string 'EmailTest'
*/
public $name = 'EmailTest';
/**
* uses property
*
@ -133,7 +126,7 @@ class EmailComponentTest extends CakeTestCase {
/**
* name property
*
* @var string 'Email'
* @var string
*/
public $name = 'Email';

View file

@ -32,13 +32,6 @@ App::uses('CakeResponse', 'Network');
*/
class PaginatorTestController extends Controller {
/**
* name property
*
* @var string 'PaginatorTest'
*/
public $name = 'PaginatorTest';
/**
* components property
*
@ -54,17 +47,10 @@ class PaginatorTestController extends Controller {
*/
class PaginatorControllerPost extends CakeTestModel {
/**
* name property
*
* @var string 'PaginatorControllerPost'
*/
public $name = 'PaginatorControllerPost';
/**
* useTable property
*
* @var string 'posts'
* @var string
*/
public $useTable = 'posts';
@ -124,17 +110,10 @@ class PaginatorControllerPost extends CakeTestModel {
*/
class ControllerPaginateModel extends CakeTestModel {
/**
* name property
*
* @var string 'ControllerPaginateModel'
*/
public $name = 'ControllerPaginateModel';
/**
* useTable property
*
* @var string 'comments'
* @var string
*/
public $useTable = 'comments';
@ -169,21 +148,21 @@ class PaginatorControllerComment extends CakeTestModel {
/**
* name property
*
* @var string 'Comment'
* @var string
*/
public $name = 'Comment';
/**
* useTable property
*
* @var string 'comments'
* @var string
*/
public $useTable = 'comments';
/**
* alias property
*
* @var string 'PaginatorControllerComment'
* @var string
*/
public $alias = 'PaginatorControllerComment';
}
@ -195,31 +174,17 @@ class PaginatorControllerComment extends CakeTestModel {
*/
class PaginatorAuthor extends CakeTestModel {
/**
* name property
*
* @var string 'PaginatorAuthor'
*/
public $name = 'PaginatorAuthor';
/**
* useTable property
*
* @var string 'authors'
* @var string
*/
public $useTable = 'authors';
/**
* alias property
*
* @var string 'PaginatorAuthor'
*/
public $alias = 'PaginatorAuthor';
/**
* alias property
*
* @var string 'PaginatorAuthor'
* @var string
*/
public $virtualFields = array(
'joined_offset' => 'PaginatorAuthor.id + 1'

View file

@ -47,13 +47,6 @@ class TestSecurityComponent extends SecurityComponent {
*/
class SecurityTestController extends Controller {
/**
* name property
*
* @var string 'SecurityTest'
*/
public $name = 'SecurityTest';
/**
* components property
*

View file

@ -28,13 +28,6 @@ App::uses('Component', 'Controller');
*/
class ParamTestComponent extends Component {
/**
* name property
*
* @var string 'ParamTest'
*/
public $name = 'ParamTest';
/**
* components property
*
@ -50,13 +43,6 @@ class ParamTestComponent extends Component {
*/
class ComponentTestController extends Controller {
/**
* name property
*
* @var string 'ComponentTest'
*/
public $name = 'ComponentTest';
/**
* uses property
*
@ -146,7 +132,7 @@ class BananaComponent extends Component {
/**
* testField property
*
* @var string 'BananaField'
* @var string
*/
public $testField = 'BananaField';

View file

@ -60,13 +60,6 @@ class MergeVarComponent extends Object {
*/
class MergeVariablesController extends MergeVarsAppController {
/**
* name
*
* @var string
*/
public $name = 'MergeVariables';
/**
* uses
*
@ -118,13 +111,6 @@ class MergeVarPluginAppController extends MergeVarsAppController {
*/
class MergePostsController extends MergeVarPluginAppController {
/**
* name
*
* @var string
*/
public $name = 'MergePosts';
/**
* uses
*

View file

@ -58,17 +58,10 @@ class ControllerTestAppController extends Controller {
*/
class ControllerPost extends CakeTestModel {
/**
* name property
*
* @var string 'ControllerPost'
*/
public $name = 'ControllerPost';
/**
* useTable property
*
* @var string 'posts'
* @var string
*/
public $useTable = 'posts';
@ -121,13 +114,6 @@ class ControllerPost extends CakeTestModel {
*/
class ControllerCommentsController extends ControllerTestAppController {
/**
* name property
*
* @var string 'ControllerPost'
*/
public $name = 'ControllerComments';
protected $_mergeParent = 'ControllerTestAppController';
}
@ -141,14 +127,14 @@ class ControllerComment extends CakeTestModel {
/**
* name property
*
* @var string 'ControllerComment'
* @var string
*/
public $name = 'Comment';
/**
* useTable property
*
* @var string 'comments'
* @var string
*/
public $useTable = 'comments';
@ -162,7 +148,7 @@ class ControllerComment extends CakeTestModel {
/**
* alias property
*
* @var string 'ControllerComment'
* @var string
*/
public $alias = 'ControllerComment';
}
@ -174,24 +160,17 @@ class ControllerComment extends CakeTestModel {
*/
class ControllerAlias extends CakeTestModel {
/**
* name property
*
* @var string 'ControllerAlias'
*/
public $name = 'ControllerAlias';
/**
* alias property
*
* @var string 'ControllerSomeAlias'
* @var string
*/
public $alias = 'ControllerSomeAlias';
/**
* useTable property
*
* @var string 'posts'
* @var string
*/
public $useTable = 'posts';
}
@ -205,20 +184,20 @@ class NameTest extends CakeTestModel {
/**
* name property
* @var string 'Name'
* @var string
*/
public $name = 'Name';
/**
* useTable property
* @var string 'names'
* @var string
*/
public $useTable = 'comments';
/**
* alias property
*
* @var string 'ControllerComment'
* @var string
*/
public $alias = 'Name';
}
@ -230,12 +209,6 @@ class NameTest extends CakeTestModel {
*/
class TestController extends ControllerTestAppController {
/**
* name property
* @var string 'Name'
*/
public $name = 'Test';
/**
* helpers property
*
@ -381,12 +354,6 @@ class Test2Component extends TestComponent {
*/
class AnotherTestController extends ControllerTestAppController {
/**
* name property
* @var string 'Name'
*/
public $name = 'AnotherTest';
/**
* uses property
*

View file

@ -33,13 +33,6 @@ require_once dirname(dirname(__FILE__)) . DS . 'Model' . DS . 'models.php';
*/
class ScaffoldMockController extends Controller {
/**
* name property
*
* @var string 'ScaffoldMock'
*/
public $name = 'ScaffoldMock';
/**
* scaffold property
*
@ -58,7 +51,7 @@ class ScaffoldMockControllerWithFields extends Controller {
/**
* name property
*
* @var string 'ScaffoldMock'
* @var string
*/
public $name = 'ScaffoldMock';

View file

@ -30,17 +30,10 @@ App::uses('Model', 'Model');
*/
class RequestActionPost extends CakeTestModel {
/**
* name property
*
* @var string 'ControllerPost'
*/
public $name = 'RequestActionPost';
/**
* useTable property
*
* @var string 'posts'
* @var string
*/
public $useTable = 'posts';
}
@ -149,14 +142,14 @@ class TestObject extends Object {
/**
* firstName property
*
* @var string 'Joel'
* @var string
*/
public $firstName = 'Joel';
/**
* lastName property
*
* @var string 'Moss'
* @var string
*/
public $lastName = 'Moss';
@ -282,8 +275,6 @@ class ObjectTestModel extends CakeTestModel {
public $useTable = false;
public $name = 'ObjectTestModel';
}
/**

View file

@ -30,13 +30,6 @@ App::uses('Router', 'Routing');
*/
class AuthBlueberryUser extends CakeTestModel {
/**
* name property
*
* @var string 'AuthBlueberryUser'
*/
public $name = 'AuthBlueberryUser';
/**
* useTable property
*

View file

@ -31,7 +31,7 @@ class DbAclNodeTestBase extends AclNode {
/**
* useDbConfig property
*
* @var string 'test'
* @var string
*/
public $useDbConfig = 'test';
@ -50,17 +50,10 @@ class DbAclNodeTestBase extends AclNode {
*/
class DbAroTest extends DbAclNodeTestBase {
/**
* name property
*
* @var string 'DbAroTest'
*/
public $name = 'DbAroTest';
/**
* useTable property
*
* @var string 'aros'
* @var string
*/
public $useTable = 'aros';
@ -79,17 +72,10 @@ class DbAroTest extends DbAclNodeTestBase {
*/
class DbAcoTest extends DbAclNodeTestBase {
/**
* name property
*
* @var string 'DbAcoTest'
*/
public $name = 'DbAcoTest';
/**
* useTable property
*
* @var string 'acos'
* @var string
*/
public $useTable = 'acos';
@ -108,17 +94,10 @@ class DbAcoTest extends DbAclNodeTestBase {
*/
class DbPermissionTest extends CakeTestModel {
/**
* name property
*
* @var string 'DbPermissionTest'
*/
public $name = 'DbPermissionTest';
/**
* useTable property
*
* @var string 'aros_acos'
* @var string
*/
public $useTable = 'aros_acos';
@ -144,17 +123,10 @@ class DbPermissionTest extends CakeTestModel {
*/
class DbAcoActionTest extends CakeTestModel {
/**
* name property
*
* @var string 'DbAcoActionTest'
*/
public $name = 'DbAcoActionTest';
/**
* useTable property
*
* @var string 'aco_actions'
* @var string
*/
public $useTable = 'aco_actions';
@ -176,14 +148,14 @@ class DbAroUserTest extends CakeTestModel {
/**
* name property
*
* @var string 'AuthUser'
* @var string
*/
public $name = 'AuthUser';
/**
* useTable property
*
* @var string 'auth_users'
* @var string
*/
public $useTable = 'auth_users';

View file

@ -33,13 +33,6 @@ App::uses('DbAcl', 'Model');
*/
class AclPerson extends CakeTestModel {
/**
* name property
*
* @var string
*/
public $name = 'AclPerson';
/**
* useTable property
*

View file

@ -531,6 +531,36 @@ class TranslateBehaviorTest extends CakeTestCase {
$this->assertEquals($expected, $result);
}
/**
* test saving/deleting with an alias, uses the model name.
*
* @return void
*/
public function testSaveDeleteIgnoreAlias() {
$this->loadFixtures('Translate', 'TranslatedItem');
$TestModel = new TranslatedItem(array('alias' => 'SomethingElse'));
$TestModel->locale = 'spa';
$data = array(
'slug' => 'fourth_translated',
'title' => 'Leyenda #4',
'content' => 'Contenido #4',
'translated_article_id' => 1,
);
$TestModel->create($data);
$TestModel->save();
$id = $TestModel->id;
$result = $TestModel->read();
$expected = array($TestModel->alias => array_merge($data, array('id' => $id, 'locale' => 'spa')));
$this->assertEquals($expected, $result);
$TestModel->delete($id);
$result = $TestModel->translateModel()->find('count', array(
'conditions' => array('foreign_key' => $id)
));
$this->assertEquals(0, $result);
}
/**
* test save multiple locales method
*

View file

@ -29,17 +29,10 @@ App::uses('CakeTestFixture', 'TestSuite/Fixture');
*/
class MyAppSchema extends CakeSchema {
/**
* name property
*
* @var string 'MyApp'
*/
public $name = 'MyApp';
/**
* connection property
*
* @var string 'test'
* @var string
*/
public $connection = 'test';
@ -127,7 +120,7 @@ class TestAppSchema extends CakeSchema {
/**
* name property
*
* @var string 'MyApp'
* @var string
*/
public $name = 'MyApp';
@ -232,17 +225,10 @@ class TestAppSchema extends CakeSchema {
*/
class SchemaPost extends CakeTestModel {
/**
* name property
*
* @var string 'SchemaPost'
*/
public $name = 'SchemaPost';
/**
* useTable property
*
* @var string 'posts'
* @var string
*/
public $useTable = 'posts';
@ -268,17 +254,10 @@ class SchemaPost extends CakeTestModel {
*/
class SchemaComment extends CakeTestModel {
/**
* name property
*
* @var string 'SchemaComment'
*/
public $name = 'SchemaComment';
/**
* useTable property
*
* @var string 'comments'
* @var string
*/
public $useTable = 'comments';
@ -297,17 +276,10 @@ class SchemaComment extends CakeTestModel {
*/
class SchemaTag extends CakeTestModel {
/**
* name property
*
* @var string 'SchemaTag'
*/
public $name = 'SchemaTag';
/**
* useTable property
*
* @var string 'tags'
* @var string
*/
public $useTable = 'tags';
@ -326,17 +298,10 @@ class SchemaTag extends CakeTestModel {
*/
class SchemaDatatype extends CakeTestModel {
/**
* name property
*
* @var string 'SchemaDatatype'
*/
public $name = 'SchemaDatatype';
/**
* useTable property
*
* @var string 'datatypes'
* @var string
*/
public $useTable = 'datatypes';
}
@ -352,13 +317,6 @@ class SchemaDatatype extends CakeTestModel {
* @package Cake.Test.Case.Model
*/
class Testdescribe extends CakeTestModel {
/**
* name property
*
* @var string 'Testdescribe'
*/
public $name = 'Testdescribe';
}
/**
@ -368,24 +326,17 @@ class Testdescribe extends CakeTestModel {
*/
class SchemaCrossDatabase extends CakeTestModel {
/**
* name property
*
* @var string 'SchemaCrossDatabase'
*/
public $name = 'SchemaCrossDatabase';
/**
* useTable property
*
* @var string 'posts'
* @var string
*/
public $useTable = 'cross_database';
/**
* useDbConfig property
*
* @var string 'test2'
* @var string
*/
public $useDbConfig = 'test2';
}
@ -400,13 +351,14 @@ class SchemaCrossDatabaseFixture extends CakeTestFixture {
/**
* name property
*
* @var string 'CrossDatabase'
* @var string
*/
public $name = 'CrossDatabase';
/**
* table property
*
* @var string
*/
public $table = 'cross_database';
@ -438,13 +390,6 @@ class SchemaCrossDatabaseFixture extends CakeTestFixture {
*/
class SchemaPrefixAuthUser extends CakeTestModel {
/**
* name property
*
* @var string
*/
public $name = 'SchemaPrefixAuthUser';
/**
* table prefix
*

View file

@ -66,13 +66,6 @@ class DboPostgresTestDb extends Postgres {
*/
class PostgresTestModel extends Model {
/**
* name property
*
* @var string 'PostgresTestModel'
*/
public $name = 'PostgresTestModel';
/**
* useTable property
*
@ -154,13 +147,6 @@ class PostgresTestModel extends Model {
*/
class PostgresClientTestModel extends Model {
/**
* name property
*
* @var string 'PostgresClientTestModel'
*/
public $name = 'PostgresClientTestModel';
/**
* useTable property
*
@ -1039,7 +1025,8 @@ class PostgresTest extends CakeTestCase {
$this->assertEquals(' LIMIT 20 OFFSET 10', $result);
$result = $db->limit(10, 300000000000000000000000000000);
$this->assertEquals(' LIMIT 10 OFFSET 0', $result);
$scientificNotation = sprintf('%.1E', 300000000000000000000000000000);
$this->assertNotContains($scientificNotation, $result);
}
}

View file

@ -495,7 +495,8 @@ class SqliteTest extends CakeTestCase {
$this->assertEquals(' LIMIT 20 OFFSET 10', $result);
$result = $db->limit(10, 300000000000000000000000000000);
$this->assertEquals(' LIMIT 10 OFFSET 0', $result);
$scientificNotation = sprintf('%.1E', 300000000000000000000000000000);
$this->assertNotContains($scientificNotation, $result);
}
}

View file

@ -115,13 +115,6 @@ class SqlserverTestDb extends Sqlserver {
*/
class SqlserverTestModel extends CakeTestModel {
/**
* name property
*
* @var string 'SqlserverTestModel'
*/
public $name = 'SqlserverTestModel';
/**
* useTable property
*
@ -188,13 +181,6 @@ class SqlserverTestModel extends CakeTestModel {
*/
class SqlserverClientTestModel extends CakeTestModel {
/**
* name property
*
* @var string 'SqlserverAssociatedTestModel'
*/
public $name = 'SqlserverClientTestModel';
/**
* useTable property
*

View file

@ -1270,7 +1270,8 @@ class DboSourceTest extends CakeTestCase {
$this->assertEquals(' LIMIT 10, 20', $result);
$result = $db->limit(10, 300000000000000000000000000000);
$this->assertEquals(' LIMIT 0, 10', $result);
$scientificNotation = sprintf('%.1E', 300000000000000000000000000000);
$this->assertNotContains($scientificNotation, $result);
}
}

View file

@ -30,8 +30,6 @@ class_exists('CakeSession');
*/
class SessionTestModel extends Model {
public $name = 'SessionTestModel';
public $useTable = 'sessions';
}

File diff suppressed because it is too large Load diff

View file

@ -122,13 +122,6 @@ interface DispatcherTestInterfaceController {
*/
class MyPluginController extends MyPluginAppController {
/**
* name property
*
* @var string 'MyPlugin'
*/
public $name = 'MyPlugin';
/**
* uses property
*
@ -173,13 +166,6 @@ class MyPluginController extends MyPluginAppController {
*/
class SomePagesController extends AppController {
/**
* name property
*
* @var string 'SomePages'
*/
public $name = 'SomePages';
/**
* uses property
*
@ -234,13 +220,6 @@ class SomePagesController extends AppController {
*/
class OtherPagesController extends MyPluginAppController {
/**
* name property
*
* @var string 'OtherPages'
*/
public $name = 'OtherPages';
/**
* uses property
*
@ -276,13 +255,6 @@ class OtherPagesController extends MyPluginAppController {
*/
class TestDispatchPagesController extends AppController {
/**
* name property
*
* @var string 'TestDispatchPages'
*/
public $name = 'TestDispatchPages';
/**
* uses property
*
@ -325,13 +297,6 @@ class ArticlesTestAppController extends AppController {
*/
class ArticlesTestController extends ArticlesTestAppController {
/**
* name property
*
* @var string 'ArticlesTest'
*/
public $name = 'ArticlesTest';
/**
* uses property
*
@ -366,13 +331,6 @@ class ArticlesTestController extends ArticlesTestAppController {
*/
class SomePostsController extends AppController {
/**
* name property
*
* @var string 'SomePosts'
*/
public $name = 'SomePosts';
/**
* uses property
*
@ -428,13 +386,6 @@ class SomePostsController extends AppController {
*/
class TestCachedPagesController extends Controller {
/**
* name property
*
* @var string 'TestCachedPages'
*/
public $name = 'TestCachedPages';
/**
* uses property
*
@ -470,7 +421,7 @@ class TestCachedPagesController extends Controller {
/**
* viewPath property
*
* @var string 'posts'
* @var string
*/
public $viewPath = 'Posts';
@ -529,13 +480,6 @@ class TestCachedPagesController extends Controller {
*/
class TimesheetsController extends Controller {
/**
* name property
*
* @var string 'Timesheets'
*/
public $name = 'Timesheets';
/**
* uses property
*

View file

@ -40,8 +40,10 @@ class CakeTimeTest extends CakeTestCase {
* @return void
*/
public function setUp() {
parent::setUp();
$this->Time = new CakeTime();
$this->_systemTimezoneIdentifier = date_default_timezone_get();
Configure::write('Config.language', 'eng');
}
/**

View file

@ -41,13 +41,6 @@ class ClassRegisterModel extends CakeTestModel {
* @package Cake.Test.Case.Utility
*/
class RegisterArticle extends ClassRegisterModel {
/**
* name property
*
* @var string 'RegisterArticle'
*/
public $name = 'RegisterArticle';
}
/**
@ -56,13 +49,6 @@ class RegisterArticle extends ClassRegisterModel {
* @package Cake.Test.Case.Utility
*/
class RegisterArticleFeatured extends ClassRegisterModel {
/**
* name property
*
* @var string 'RegisterArticleFeatured'
*/
public $name = 'RegisterArticleFeatured';
}
/**
@ -71,13 +57,6 @@ class RegisterArticleFeatured extends ClassRegisterModel {
* @package Cake.Test.Case.Utility
*/
class RegisterArticleTag extends ClassRegisterModel {
/**
* name property
*
* @var string 'RegisterArticleTag'
*/
public $name = 'RegisterArticleTag';
}
/**
@ -90,7 +69,7 @@ class RegistryPluginAppModel extends ClassRegisterModel {
/**
* tablePrefix property
*
* @var string 'something_'
* @var string
*/
public $tablePrefix = 'something_';
}
@ -101,13 +80,6 @@ class RegistryPluginAppModel extends ClassRegisterModel {
* @package Cake.Test.Case.Utility
*/
class TestRegistryPluginModel extends RegistryPluginAppModel {
/**
* name property
*
* @var string 'TestRegistryPluginModel'
*/
public $name = 'TestRegistryPluginModel';
}
/**
@ -116,13 +88,6 @@ class TestRegistryPluginModel extends RegistryPluginAppModel {
* @package Cake.Test.Case.Utility
*/
class RegisterCategory extends ClassRegisterModel {
/**
* name property
*
* @var string 'RegisterCategory'
*/
public $name = 'RegisterCategory';
}
/**
* RegisterPrefixedDs class
@ -134,7 +99,7 @@ class RegisterPrefixedDs extends ClassRegisterModel {
/**
* useDbConfig property
*
* @var string 'doesnotexist'
* @var string
*/
public $useDbConfig = 'doesnotexist';
}

View file

@ -27,17 +27,10 @@ App::uses('Sanitize', 'Utility');
*/
class SanitizeDataTest extends CakeTestModel {
/**
* name property
*
* @var string 'SanitizeDataTest'
*/
public $name = 'SanitizeDataTest';
/**
* useTable property
*
* @var string 'data_tests'
* @var string
*/
public $useTable = 'data_tests';
}
@ -49,17 +42,10 @@ class SanitizeDataTest extends CakeTestModel {
*/
class SanitizeArticle extends CakeTestModel {
/**
* name property
*
* @var string 'Article'
*/
public $name = 'SanitizeArticle';
/**
* useTable property
*
* @var string 'articles'
* @var string
*/
public $useTable = 'articles';
}

View file

@ -31,7 +31,7 @@ class XmlArticle extends CakeTestModel {
/**
* name property
*
* @var string 'Article'
* @var string
*/
public $name = 'Article';
@ -58,7 +58,7 @@ class XmlUser extends CakeTestModel {
/**
* name property
*
* @var string 'User'
* @var string
*/
public $name = 'User';
@ -375,6 +375,19 @@ XML;
$obj = Xml::fromArray($xml, 'attributes');
$xmlText = '<' . '?xml version="1.0" encoding="UTF-8"?><tags><tag id="1">defect</tag></tags>';
$this->assertXmlStringEqualsXmlString($xmlText, $obj->asXML());
$xml = array(
'tag' => array(
'@' => 0,
'@test' => 'A test'
)
);
$obj = Xml::fromArray($xml);
$xmlText = <<<XML
<?xml version="1.0" encoding="UTF-8"?>
<tag test="A test">0</tag>
XML;
$this->assertXmlStringEqualsXmlString($xmlText, $obj->asXML());
}
/**

View file

@ -181,7 +181,7 @@ class ContactNonStandardPk extends Contact {
/**
* primaryKey property
*
* @var string 'pk'
* @var string
*/
public $primaryKey = 'pk';
@ -4583,6 +4583,125 @@ class FormHelperTest extends CakeTestCase {
'/div'
);
$this->assertTags($result, $expected);
$options = array(1 => 'One', 2 => 'Two', '3' => 'Three', '3x' => 'Stringy');
$disabled = true;
$result = $this->Form->input('Contact.multiple', array('multiple' => 'multiple', 'disabled' => $disabled, 'options' => $options));
$expected = array(
array('div' => array('class' => 'input select')),
array('label' => array('for' => 'ContactMultiple')),
'Multiple',
'/label',
'input' => array(
'type' => 'hidden', 'name' => 'data[Contact][multiple]', 'value' => '', 'id' => 'ContactMultiple_'
),
'select' => array(
'name' => 'data[Contact][multiple][]', 'disabled' => 'disabled', 'multiple' => 'multiple', 'id' => 'ContactMultiple'
),
array('option' => array('value' => '1')),
'One',
'/option',
array('option' => array('value' => '2')),
'Two',
'/option',
array('option' => array('value' => '3')),
'Three',
'/option',
array('option' => array('value' => '3x')),
'Stringy',
'/option',
'/select',
'/div'
);
$this->assertTags($result, $expected);
}
/**
* Test generating select with disabled elements.
*
* @return void
*/
public function testSelectWithDisabledElements() {
$options = array(1 => 'One', 2 => 'Two', '3' => 'Three', '3x' => 'Stringy');
$disabled = array(2, 3);
$result = $this->Form->select('Model.field', $options, array('disabled' => $disabled));
$expected = array(
'select' => array(
'name' => 'data[Model][field]', 'id' => 'ModelField'
),
array('option' => array('value' => '')),
'/option',
array('option' => array('value' => '1')),
'One',
'/option',
array('option' => array('value' => '2', 'disabled' => 'disabled')),
'Two',
'/option',
array('option' => array('value' => '3', 'disabled' => 'disabled')),
'Three',
'/option',
array('option' => array('value' => '3x')),
'Stringy',
'/option',
'/select'
);
$this->assertTags($result, $expected);
$options = array(1 => 'One', 2 => 'Two', '3' => 'Three', '3x' => 'Stringy');
$disabled = array('2', '3x');
$result = $this->Form->input('Model.field', array('disabled' => $disabled, 'options' => $options));
$expected = array(
array('div' => array('class' => 'input select')),
array('label' => array('for' => 'ModelField')),
'Field',
'/label',
'select' => array(
'name' => 'data[Model][field]', 'id' => 'ModelField'
),
array('option' => array('value' => '1')),
'One',
'/option',
array('option' => array('value' => '2', 'disabled' => 'disabled')),
'Two',
'/option',
array('option' => array('value' => '3')),
'Three',
'/option',
array('option' => array('value' => '3x', 'disabled' => 'disabled')),
'Stringy',
'/option',
'/select',
'/div'
);
$this->assertTags($result, $expected);
$options = array(1 => 'One', 2 => 'Two', '3' => 'Three', '3x' => 'Stringy');
$disabled = true;
$result = $this->Form->input('Model.field', array('disabled' => $disabled, 'options' => $options));
$expected = array(
array('div' => array('class' => 'input select')),
array('label' => array('for' => 'ModelField')),
'Field',
'/label',
'select' => array(
'name' => 'data[Model][field]', 'id' => 'ModelField', 'disabled' => 'disabled'
),
array('option' => array('value' => '1')),
'One',
'/option',
array('option' => array('value' => '2')),
'Two',
'/option',
array('option' => array('value' => '3')),
'Three',
'/option',
array('option' => array('value' => '3x')),
'Stringy',
'/option',
'/select',
'/div'
);
$this->assertTags($result, $expected);
}
/**

View file

@ -40,7 +40,7 @@ class TheHtmlTestController extends Controller {
/**
* name property
*
* @var string 'TheTest'
* @var string
*/
public $name = 'TheTest';

View file

@ -54,7 +54,7 @@ class ScaffoldViewMockController extends Controller {
/**
* name property
*
* @var string 'ScaffoldMock'
* @var string
*/
public $name = 'ScaffoldMock';

View file

@ -32,7 +32,7 @@ class ThemePosts2Controller extends Controller {
/**
* name property
*
* @var string 'ThemePosts'
* @var string
*/
public $name = 'ThemePosts';

View file

@ -35,7 +35,7 @@ class ViewPostsController extends Controller {
/**
* name property
*
* @var string 'Posts'
* @var string
*/
public $name = 'Posts';
@ -78,13 +78,6 @@ class ViewPostsController extends Controller {
*/
class ThemePostsController extends Controller {
/**
* name property
*
* @var string 'ThemePosts'
*/
public $name = 'ThemePosts';
public $theme = null;
/**
@ -200,7 +193,7 @@ class TestAfterHelper extends Helper {
/**
* property property
*
* @var string ''
* @var string
*/
public $property = '';

View file

@ -468,7 +468,8 @@ class CakeTime {
*/
public static function isToday($dateString, $timezone = null) {
$timestamp = self::fromString($dateString, $timezone);
return date('Y-m-d', $timestamp) == date('Y-m-d', time());
$now = self::fromString('now', $timezone);
return date('Y-m-d', $timestamp) == date('Y-m-d', $now);
}
/**
@ -507,7 +508,8 @@ class CakeTime {
*/
public static function isThisWeek($dateString, $timezone = null) {
$timestamp = self::fromString($dateString, $timezone);
return date('W o', $timestamp) == date('W o', time());
$now = self::fromString('now', $timezone);
return date('W o', $timestamp) == date('W o', $now);
}
/**
@ -520,7 +522,8 @@ class CakeTime {
*/
public static function isThisMonth($dateString, $timezone = null) {
$timestamp = self::fromString($dateString, $timezone);
return date('m Y', $timestamp) == date('m Y', time());
$now = self::fromString('now', $timezone);
return date('m Y', $timestamp) == date('m Y', $now);
}
/**
@ -533,7 +536,8 @@ class CakeTime {
*/
public static function isThisYear($dateString, $timezone = null) {
$timestamp = self::fromString($dateString, $timezone);
return date('Y', $timestamp) == date('Y', time());
$now = self::fromString('now', $timezone);
return date('Y', $timestamp) == date('Y', $now);
}
/**
@ -547,7 +551,8 @@ class CakeTime {
*/
public static function wasYesterday($dateString, $timezone = null) {
$timestamp = self::fromString($dateString, $timezone);
return date('Y-m-d', $timestamp) == date('Y-m-d', strtotime('yesterday'));
$yesterday = self::fromString('yesterday', $timezone);
return date('Y-m-d', $timestamp) == date('Y-m-d', $yesterday);
}
/**
@ -560,7 +565,8 @@ class CakeTime {
*/
public static function isTomorrow($dateString, $timezone = null) {
$timestamp = self::fromString($dateString, $timezone);
return date('Y-m-d', $timestamp) == date('Y-m-d', strtotime('tomorrow'));
$tomorrow = self::fromString('tomorrow', $timezone);
return date('Y-m-d', $timestamp) == date('Y-m-d', $tomorrow);
}
/**
@ -906,8 +912,9 @@ class CakeTime {
$date = self::fromString($dateString, $timezone);
$interval = self::fromString('-' . $timeInterval);
$now = self::fromString('now', $timezone);
return $date >= $interval && $date <= time();
return $date >= $interval && $date <= $now;
}
/**
@ -928,8 +935,9 @@ class CakeTime {
$date = self::fromString($dateString, $timezone);
$interval = self::fromString('+' . $timeInterval);
$now = self::fromString('now', $timezone);
return $date <= $interval && $date >= time();
return $date <= $interval && $date >= $now;
}
/**

View file

@ -315,7 +315,7 @@ class Xml {
}
$child = $dom->createElement($key);
if ($childValue) {
if (!is_null($childValue)) {
$child->appendChild($dom->createTextNode($childValue));
}
if ($childNS) {

View file

@ -2661,7 +2661,7 @@ class FormHelper extends AppHelper {
) {
$htmlOptions['disabled'] = 'disabled';
}
if ($hasDisabled && !$disabledIsArray) {
if ($hasDisabled && !$disabledIsArray && $attributes['style'] === 'checkbox') {
$htmlOptions['disabled'] = $attributes['disabled'] === true ? 'disabled' : $attributes['disabled'];
}