Merge branch '1.3' into scaffold-design

This commit is contained in:
Mark Story 2010-01-13 22:16:47 -05:00
commit e60243c464
14 changed files with 39 additions and 128 deletions

View file

@ -355,25 +355,6 @@ class TestSuiteShell extends Shell {
return $folder;
}
/**
* Sets some get vars needed for TestManager
*
* @return void
* @access private
*/
function __setGetVars() {
if (in_array($this->category, $this->plugins)) {
$_GET['plugin'] = $this->category;
} elseif (in_array(Inflector::humanize($this->category), $this->plugins)) {
$_GET['plugin'] = Inflector::humanize($this->category);
} elseif ($this->category == 'app') {
$_GET['app'] = true;
}
if ($this->type == 'group') {
$_GET['group'] = true;
}
}
/**
* tries to install simpletest and exits gracefully if it is not there
*

View file

@ -1,6 +1,8 @@
<?php
/**
* Short description for file.
* Index
*
* The Front Controller for handling every request
*
* PHP versions 4 and 5
*
@ -11,20 +13,18 @@
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://cakefoundation.org)
* @link http://cakephp.org CakePHP(tm) Project
* @link http://cakephp.org
* @package cake
* @subpackage cake.app.webroot
* @since CakePHP(tm) v 0.2.9
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
/**
* Use the DS to separate the directories in other defines
*/
if (!defined('DS')) {
define('DS', DIRECTORY_SEPARATOR);
}
/**
* These defines should only be edited if you have cake installed in
* a directory layout other than the way it is distributed.
@ -38,7 +38,6 @@
if (!defined('ROOT')) {
define('ROOT', dirname(dirname(dirname(__FILE__))));
}
/**
* The actual directory name for the "app".
*
@ -46,7 +45,6 @@
if (!defined('APP_DIR')) {
define('APP_DIR', basename(dirname(dirname(__FILE__))));
}
/**
* The absolute path to the "cake" directory, WITHOUT a trailing DS.
*
@ -56,7 +54,7 @@
}
/**
* Editing below this line should not be necessary.
* Editing below this line should NOT be necessary.
* Change at your own risk.
*
*/

View file

@ -18,7 +18,6 @@
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
set_time_limit(0);
ini_set('memory_limit','128M');
ini_set('display_errors', 1);
/**
* Use the DS to separate the directories in other defines
@ -85,89 +84,13 @@ if (isset($corePath[0])) {
define('TEST_CAKE_CORE_INCLUDE_PATH', CAKE_CORE_INCLUDE_PATH);
}
require_once CAKE_TESTS_LIB . 'test_manager.php';
if (Configure::read('debug') < 1) {
exit(__('Debug setting does not allow access to this url.', true));
die(__('Debug setting does not allow access to this url.', true));
}
if (!isset($_SERVER['SERVER_NAME'])) {
$_SERVER['SERVER_NAME'] = '';
}
if (empty( $_GET['output'])) {
$_GET['output'] = 'html';
}
/**
*
* Used to determine output to display
*/
define('CAKE_TEST_OUTPUT_HTML', 1);
define('CAKE_TEST_OUTPUT_TEXT', 2);
require_once CAKE_TESTS_LIB . 'cake_test_suite_dispatcher.php';
if (isset($_GET['output']) && $_GET['output'] == 'html') {
define('CAKE_TEST_OUTPUT', CAKE_TEST_OUTPUT_HTML);
} else {
Debugger::output('txt');
define('CAKE_TEST_OUTPUT', CAKE_TEST_OUTPUT_TEXT);
}
$Dispatcher = new CakeTestSuiteDispatcher();
$Dispatcher->dispatch();
if (!App::import('Vendor', 'simpletest' . DS . 'reporter')) {
CakePHPTestHeader();
include CAKE_TESTS_LIB . 'simpletest.php';
CakePHPTestSuiteFooter();
exit();
}
$analyzeCodeCoverage = false;
if (isset($_GET['code_coverage'])) {
$analyzeCodeCoverage = true;
require_once CAKE_TESTS_LIB . 'code_coverage_manager.php';
if (!extension_loaded('xdebug')) {
CakePHPTestHeader();
include CAKE_TESTS_LIB . 'xdebug.php';
CakePHPTestSuiteFooter();
exit();
}
}
CakePHPTestHeader();
CakePHPTestSuiteHeader();
define('RUN_TEST_LINK', $_SERVER['PHP_SELF']);
if (isset($_GET['group'])) {
if ('all' == $_GET['group']) {
TestManager::runAllTests(CakeTestsGetReporter());
} else {
if ($analyzeCodeCoverage) {
CodeCoverageManager::start($_GET['group'], CakeTestsGetReporter());
}
TestManager::runGroupTest(ucfirst($_GET['group']), CakeTestsGetReporter());
if ($analyzeCodeCoverage) {
CodeCoverageManager::report();
}
}
CakePHPTestRunMore();
CakePHPTestAnalyzeCodeCoverage();
} elseif (isset($_GET['case'])) {
if ($analyzeCodeCoverage) {
CodeCoverageManager::start($_GET['case'], CakeTestsGetReporter());
}
TestManager::runTestCase($_GET['case'], CakeTestsGetReporter());
if ($analyzeCodeCoverage) {
CodeCoverageManager::report();
}
CakePHPTestRunMore();
CakePHPTestAnalyzeCodeCoverage();
} elseif (isset($_GET['show']) && $_GET['show'] == 'cases') {
CakePHPTestCaseList();
} else {
CakePHPTestGroupTestList();
}
CakePHPTestSuiteFooter();
$output = ob_get_clean();
echo $output;
?>

View file

@ -53,7 +53,11 @@ class AclBehavior extends ModelBehavior {
if (!class_exists('AclNode')) {
require LIBS . 'model' . DS . 'db_acl.php';
}
$model->{$type} =& ClassRegistry::init($type);
if (PHP5) {
$model->{$type} = ClassRegistry::init($type);
} else {
$model->{$type} =& ClassRegistry::init($type);
}
if (!method_exists($model, 'parentNode')) {
trigger_error("Callback parentNode() not defined in {$model->alias}", E_USER_WARNING);
}

View file

@ -1310,7 +1310,12 @@ class FormHelper extends AppHelper {
$style = ($attributes['multiple'] === 'checkbox') ? 'checkbox' : null;
$template = ($style) ? 'checkboxmultiplestart' : 'selectmultiplestart';
$tag = $this->Html->tags[$template];
$select[] = $this->hidden(null, array('value' => '', 'id' => null, 'secure' => false));
$hiddenAttributes = array(
'value' => '',
'id' => $attributes['id'] . ($style ? '' : '_'),
'secure' => false
);
$select[] = $this->hidden(null, $hiddenAttributes);
} else {
$tag = $this->Html->tags['selectstart'];
}

View file

@ -18,7 +18,7 @@
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
*/
require_once CAKE . 'tests' . DS . 'lib' . DS . 'code_coverage_manager.php';
require_once CAKE . 'tests' . DS . 'lib' . DS . 'cli_reporter.php';
require_once CAKE . 'tests' . DS . 'lib' . DS . 'reporter' . DS . 'cake_cli_reporter.php';
/**
* CodeCoverageManagerTest class

View file

@ -1860,7 +1860,7 @@ class FormHelperTest extends CakeTestCase {
$this->Form->data = array('Contact' => array('created' => null));
$result = $this->Form->input('Contact.created', array('type' => 'datetime', 'dateFormat' => 'NONE'));
$this->assertPattern('/for\="ContactCreatedHour"/', $result);
$this->Form->data = array('Contact' => array('created' => null));
$result = $this->Form->input('Contact.created', array('type' => 'datetime', 'timeFormat' => 'NONE'));
$this->assertPattern('/for\="ContactCreatedMonth"/', $result);
@ -2015,7 +2015,7 @@ class FormHelperTest extends CakeTestCase {
'label' => array('for' => 'UserUser'),
'User',
'/label',
'input' => array('type' => 'hidden', 'name' => 'data[User][User]', 'value' => ''),
'input' => array('type' => 'hidden', 'name' => 'data[User][User]', 'value' => '', 'id' => 'UserUser_'),
'select' => array('name' => 'data[User][User][]', 'id' => 'UserUser', 'multiple' => 'multiple'),
array('option' => array('value' => '')),
'/option',
@ -2267,7 +2267,7 @@ class FormHelperTest extends CakeTestCase {
function testSelectAsCheckbox() {
$result = $this->Form->select('Model.multi_field', array('first', 'second', 'third'), array(0, 1), array('multiple' => 'checkbox'));
$expected = array(
'input' => array('type' => 'hidden', 'name' => 'data[Model][multi_field]', 'value' => ''),
'input' => array('type' => 'hidden', 'name' => 'data[Model][multi_field]', 'value' => '', 'id' => 'ModelMultiField'),
array('div' => array('class' => 'checkbox')),
array('input' => array('type' => 'checkbox', 'name' => 'data[Model][multi_field][]', 'checked' => 'checked', 'value' => '0', 'id' => 'ModelMultiField0')),
array('label' => array('for' => 'ModelMultiField0', 'class' => 'selected')),
@ -2978,7 +2978,7 @@ class FormHelperTest extends CakeTestCase {
);
$expected = array(
'input' => array(
'type' => 'hidden', 'name' => 'data[Model][multi_field]', 'value' => ''
'type' => 'hidden', 'name' => 'data[Model][multi_field]', 'value' => '', 'id' => 'ModelMultiField_'
),
'select' => array(
'name' => 'data[Model][multi_field][]',
@ -3002,7 +3002,7 @@ class FormHelperTest extends CakeTestCase {
);
$expected = array(
'input' => array(
'type' => 'hidden', 'name' => 'data[Model][multi_field]', 'value' => ''
'type' => 'hidden', 'name' => 'data[Model][multi_field]', 'value' => '', 'id' => 'ModelMultiField_'
),
'select' => array(
'name' => 'data[Model][multi_field][]',
@ -3026,7 +3026,7 @@ class FormHelperTest extends CakeTestCase {
);
$expected = array(
'input' => array(
'type' => 'hidden', 'name' => 'data[Model][multi_field]', 'value' => ''
'type' => 'hidden', 'name' => 'data[Model][multi_field]', 'value' => '', 'id' => 'ModelMultiField_'
),
'select' => array(
'name' => 'data[Model][multi_field][]', 'id' => 'ModelMultiField',
@ -3075,7 +3075,7 @@ class FormHelperTest extends CakeTestCase {
$result = $this->Form->input('ContactTag', array('div' => false, 'label' => false));
$expected = array(
'input' => array(
'type' => 'hidden', 'name' => 'data[ContactTag][ContactTag]', 'value' => ''
'type' => 'hidden', 'name' => 'data[ContactTag][ContactTag]', 'value' => '', 'id' => 'ContactTagContactTag_'
),
'select' => array(
'name' => 'data[ContactTag][ContactTag][]', 'id' => 'ContactTagContactTag',
@ -3110,7 +3110,7 @@ class FormHelperTest extends CakeTestCase {
$expected = array(
'input' => array(
'type' => 'hidden', 'name' => 'data[Model][multi_field]', 'value' => ''
'type' => 'hidden', 'name' => 'data[Model][multi_field]', 'value' => '', 'id' => 'ModelMultiField'
),
array('div' => array('class' => 'checkbox')),
array('input' => array(
@ -3149,7 +3149,7 @@ class FormHelperTest extends CakeTestCase {
);
$expected = array(
'input' => array(
'type' => 'hidden', 'name' => 'data[Model][multi_field]', 'value' => ''
'type' => 'hidden', 'name' => 'data[Model][multi_field]', 'value' => '', 'id' => 'ModelMultiField'
),
array('div' => array('class' => 'checkbox')),
array('input' => array(
@ -3186,7 +3186,7 @@ class FormHelperTest extends CakeTestCase {
);
$expected = array(
'input' => array(
'type' => 'hidden', 'name' => 'data[Model][multi_field]', 'value' => ''
'type' => 'hidden', 'name' => 'data[Model][multi_field]', 'value' => '', 'id' => 'ModelMultiField'
),
array('div' => array('class' => 'checkbox')),
array('input' => array(
@ -3237,7 +3237,7 @@ class FormHelperTest extends CakeTestCase {
array('label' => array('for' => 'ModelMultiField')),
'Multi Field',
'/label',
'input' => array('type' => 'hidden', 'name' => 'data[Model][multi_field]', 'value' => ''),
'input' => array('type' => 'hidden', 'name' => 'data[Model][multi_field]', 'value' => '', 'id' => 'ModelMultiField'),
array('div' => array('class' => 'checkbox')),
array('input' => array('type' => 'checkbox', 'name' => 'data[Model][multi_field][]', 'value' => '0', 'id' => 'ModelMultiField0')),
array('label' => array('for' => 'ModelMultiField0')),
@ -3266,7 +3266,7 @@ class FormHelperTest extends CakeTestCase {
array('label' => array('for' => 'ModelMultiField')),
'Multi Field',
'/label',
'input' => array('type' => 'hidden', 'name' => 'data[Model][multi_field]', 'value' => ''),
'input' => array('type' => 'hidden', 'name' => 'data[Model][multi_field]', 'value' => '', 'id' => 'ModelMultiField'),
array('div' => array('class' => 'checkbox')),
array('input' => array('type' => 'checkbox', 'name' => 'data[Model][multi_field][]', 'value' => 'a', 'id' => 'ModelMultiFieldA')),
array('label' => array('for' => 'ModelMultiFieldA')),
@ -3291,7 +3291,7 @@ class FormHelperTest extends CakeTestCase {
$result = $this->Form->input('Model.multi_field', array('options' => array('1' => 'first'), 'multiple' => 'checkbox', 'label' => false, 'div' => false));
$expected = array(
'input' => array('type' => 'hidden', 'name' => 'data[Model][multi_field]', 'value' => ''),
'input' => array('type' => 'hidden', 'name' => 'data[Model][multi_field]', 'value' => '', 'id' => 'ModelMultiField'),
array('div' => array('class' => 'checkbox')),
array('input' => array('type' => 'checkbox', 'name' => 'data[Model][multi_field][]', 'value' => '1', 'id' => 'ModelMultiField1')),
array('label' => array('for' => 'ModelMultiField1')),
@ -3303,7 +3303,7 @@ class FormHelperTest extends CakeTestCase {
$result = $this->Form->input('Model.multi_field', array('options' => array('2' => 'second'), 'multiple' => 'checkbox', 'label' => false, 'div' => false));
$expected = array(
'input' => array('type' => 'hidden', 'name' => 'data[Model][multi_field]', 'value' => ''),
'input' => array('type' => 'hidden', 'name' => 'data[Model][multi_field]', 'value' => '', 'id' => 'ModelMultiField'),
array('div' => array('class' => 'checkbox')),
array('input' => array('type' => 'checkbox', 'name' => 'data[Model][multi_field][]', 'value' => '2', 'id' => 'ModelMultiField2')),
array('label' => array('for' => 'ModelMultiField2')),
@ -3923,7 +3923,7 @@ class FormHelperTest extends CakeTestCase {
'label' => array('for' => 'ContactTagContactTag'),
'Contact Tag',
'/label',
array('input' => array('type' => 'hidden', 'name' => 'data[ContactTag][ContactTag]', 'value' => '')),
array('input' => array('type' => 'hidden', 'name' => 'data[ContactTag][ContactTag]', 'value' => '', 'id' => 'ContactTagContactTag_')),
array('select' => array('name' => 'data[ContactTag][ContactTag][]', 'multiple' => 'multiple', 'id' => 'ContactTagContactTag')),
'/select',
'/div'
@ -5232,7 +5232,7 @@ class FormHelperTest extends CakeTestCase {
$this->Form->create();
$result = $this->Form->select('People.People', $options, null, array('multiple' => true));
$expected = array(
'input' => array('type' => 'hidden', 'name' => 'data[People][People]', 'value' => ''),
'input' => array('type' => 'hidden', 'name' => 'data[People][People]', 'value' => '', 'id' => 'PeoplePeople_'),
'select' => array(
'name' => 'data[People][People][]', 'multiple' => 'multiple', 'id' => 'PeoplePeople'
),

View file

@ -109,7 +109,7 @@ class CakeTestSuiteDispatcher {
*/
function _checkSimpleTest() {
if (!App::import('Vendor', 'simpletest' . DS . 'reporter')) {
$basePath = $this->_baseDir;
$baseDir = $this->_baseDir;
include CAKE_TESTS_LIB . 'templates' . DS . 'simpletest.php';
exit();
}
@ -123,7 +123,7 @@ class CakeTestSuiteDispatcher {
*/
function _checkXdebug() {
if (!extension_loaded('xdebug')) {
$basePath = $this->_baseDir;
$baseDir = $this->_baseDir;
include CAKE_TESTS_LIB . 'templates' . DS . 'xdebug.php';
exit();
}