mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge branch 'master' into 2.3
This commit is contained in:
commit
d0d13acaf4
15 changed files with 240 additions and 103 deletions
|
@ -627,7 +627,7 @@ class ConsoleOptionParser {
|
||||||
*/
|
*/
|
||||||
protected function _parseArg($argument, $args) {
|
protected function _parseArg($argument, $args) {
|
||||||
if (empty($this->_args)) {
|
if (empty($this->_args)) {
|
||||||
array_push($args, $argument);
|
$args[] = $argument;
|
||||||
return $args;
|
return $args;
|
||||||
}
|
}
|
||||||
$next = count($args);
|
$next = count($args);
|
||||||
|
@ -636,7 +636,7 @@ class ConsoleOptionParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->_args[$next]->validChoice($argument)) {
|
if ($this->_args[$next]->validChoice($argument)) {
|
||||||
array_push($args, $argument);
|
$args[] = $argument;
|
||||||
return $args;
|
return $args;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -530,6 +530,44 @@ class TranslateBehaviorTest extends CakeTestCase {
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* test save multiple locales method
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testSaveMultipleLocales() {
|
||||||
|
$this->loadFixtures('Translate', 'TranslatedItem');
|
||||||
|
|
||||||
|
$TestModel = new TranslatedItem();
|
||||||
|
$data = array(
|
||||||
|
'slug' => 'fourth_translated',
|
||||||
|
'title' => array(
|
||||||
|
'eng' => 'Title #4',
|
||||||
|
'spa' => 'Leyenda #4',
|
||||||
|
),
|
||||||
|
'content' => array(
|
||||||
|
'eng' => 'Content #4',
|
||||||
|
'spa' => 'Contenido #4',
|
||||||
|
),
|
||||||
|
'translated_article_id' => 1,
|
||||||
|
);
|
||||||
|
$TestModel->create();
|
||||||
|
$TestModel->save($data);
|
||||||
|
|
||||||
|
$translations = array('title' => 'Title', 'content' => 'Content');
|
||||||
|
$TestModel->bindTranslation($translations, false);
|
||||||
|
$TestModel->locale = array('eng', 'spa');
|
||||||
|
$result = $TestModel->read();
|
||||||
|
|
||||||
|
$this->assertCount(2, $result['Title']);
|
||||||
|
$this->assertEquals($result['Title'][0]['locale'], 'eng');
|
||||||
|
$this->assertEquals($result['Title'][0]['content'], 'Title #4');
|
||||||
|
$this->assertEquals($result['Title'][1]['locale'], 'spa');
|
||||||
|
$this->assertEquals($result['Title'][1]['content'], 'Leyenda #4');
|
||||||
|
|
||||||
|
$this->assertCount(2, $result['Content']);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testSaveAssociatedCreate method
|
* testSaveAssociatedCreate method
|
||||||
*
|
*
|
||||||
|
|
|
@ -2180,4 +2180,142 @@ class HashTest extends CakeTestCase {
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test that flattening a large complex set doesn't loop forever.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testFlattenInfiniteLoop() {
|
||||||
|
$data = array(
|
||||||
|
'Order.ASI' => '0',
|
||||||
|
'Order.Accounting' => '0',
|
||||||
|
'Order.Admin' => '0',
|
||||||
|
'Order.Art' => '0',
|
||||||
|
'Order.ArtChecker' => '0',
|
||||||
|
'Order.Canned' => '0',
|
||||||
|
'Order.Customer_Tags' => '',
|
||||||
|
'Order.Embroidery' => '0',
|
||||||
|
'Order.Item.0.Product.style_number' => 'a11222',
|
||||||
|
'Order.Item.0.Product.slug' => 'a11222',
|
||||||
|
'Order.Item.0.Product._id' => '4ff8b8d3d7bbe8ad30000000',
|
||||||
|
'Order.Item.0.Product.Color.slug' => 'kelly_green',
|
||||||
|
'Order.Item.0.Product.ColorSizes.0.Color.color' => 'Sport Grey',
|
||||||
|
'Order.Item.0.Product.ColorSizes.0.Color.slug' => 'sport_grey',
|
||||||
|
'Order.Item.0.Product.ColorSizes.1.Color.color' => 'Kelly Green',
|
||||||
|
'Order.Item.0.Product.ColorSizes.1.Color.slug' => 'kelly_green',
|
||||||
|
'Order.Item.0.Product.ColorSizes.2.Color.color' => 'Orange',
|
||||||
|
'Order.Item.0.Product.ColorSizes.2.Color.slug' => 'orange',
|
||||||
|
'Order.Item.0.Product.ColorSizes.3.Color.color' => 'Yellow Haze',
|
||||||
|
'Order.Item.0.Product.ColorSizes.3.Color.slug' => 'yellow_haze',
|
||||||
|
'Order.Item.0.Product.brand' => 'OUTER BANKS',
|
||||||
|
'Order.Item.0.Product.style' => 'T-shirt',
|
||||||
|
'Order.Item.0.Product.description' => 'uhiuhuih oin ooi ioo ioio',
|
||||||
|
'Order.Item.0.Product.sizes.0.Size.qty' => '',
|
||||||
|
'Order.Item.0.Product.sizes.0.Size.size' => '0-3mo',
|
||||||
|
'Order.Item.0.Product.sizes.0.Size.id' => '38',
|
||||||
|
'Order.Item.0.Product.sizes.1.Size.qty' => '',
|
||||||
|
'Order.Item.0.Product.sizes.1.Size.size' => '3-6mo',
|
||||||
|
'Order.Item.0.Product.sizes.1.Size.id' => '39',
|
||||||
|
'Order.Item.0.Product.sizes.2.Size.qty' => '78',
|
||||||
|
'Order.Item.0.Product.sizes.2.Size.size' => '6-9mo',
|
||||||
|
'Order.Item.0.Product.sizes.2.Size.id' => '40',
|
||||||
|
'Order.Item.0.Product.sizes.3.Size.qty' => '',
|
||||||
|
'Order.Item.0.Product.sizes.3.Size.size' => '6-12mo',
|
||||||
|
'Order.Item.0.Product.sizes.3.Size.id' => '41',
|
||||||
|
'Order.Item.0.Product.sizes.4.Size.qty' => '',
|
||||||
|
'Order.Item.0.Product.sizes.4.Size.size' => '12-18mo',
|
||||||
|
'Order.Item.0.Product.sizes.4.Size.id' => '42',
|
||||||
|
'Order.Item.0.Art.imprint_locations.0.id' => (int) 2,
|
||||||
|
'Order.Item.0.Art.imprint_locations.0.name' => 'Left Chest',
|
||||||
|
'Order.Item.0.Art.imprint_locations.0.imprint_type.id' => (int) 7,
|
||||||
|
'Order.Item.0.Art.imprint_locations.0.imprint_type.type' => 'Embroidery',
|
||||||
|
'Order.Item.0.Art.imprint_locations.0.art' => '',
|
||||||
|
'Order.Item.0.Art.imprint_locations.0.num_colors' => (int) 3,
|
||||||
|
'Order.Item.0.Art.imprint_locations.0.description' => 'Wooo! This is Embroidery!!',
|
||||||
|
'Order.Item.0.Art.imprint_locations.0.lines.0' => 'Platen',
|
||||||
|
'Order.Item.0.Art.imprint_locations.0.lines.1' => 'Logo',
|
||||||
|
'Order.Item.0.Art.imprint_locations.0.height' => (int) 4,
|
||||||
|
'Order.Item.0.Art.imprint_locations.0.width' => (int) 5,
|
||||||
|
'Order.Item.0.Art.imprint_locations.0.stitch_density' => 'Light',
|
||||||
|
'Order.Item.0.Art.imprint_locations.0.metallic_thread' => true,
|
||||||
|
'Order.Item.0.Art.imprint_locations.1.id' => (int) 4,
|
||||||
|
'Order.Item.0.Art.imprint_locations.1.name' => 'Full Back',
|
||||||
|
'Order.Item.0.Art.imprint_locations.1.imprint_type.id' => (int) 6,
|
||||||
|
'Order.Item.0.Art.imprint_locations.1.imprint_type.type' => 'Screenprinting',
|
||||||
|
'Order.Item.0.Art.imprint_locations.1.art' => '',
|
||||||
|
'Order.Item.0.Art.imprint_locations.1.num_colors' => (int) 3,
|
||||||
|
'Order.Item.0.Art.imprint_locations.1.description' => 'Wooo! This is Screenprinting!!',
|
||||||
|
'Order.Item.0.Art.imprint_locations.1.lines.0' => 'Platen',
|
||||||
|
'Order.Item.0.Art.imprint_locations.1.lines.1' => 'Logo',
|
||||||
|
'Order.Item.0.Art.imprint_locations.2.id' => (int) 26,
|
||||||
|
'Order.Item.0.Art.imprint_locations.2.name' => 'HS - JSY Name Below',
|
||||||
|
'Order.Item.0.Art.imprint_locations.2.imprint_type.id' => (int) 9,
|
||||||
|
'Order.Item.0.Art.imprint_locations.2.imprint_type.type' => 'Names',
|
||||||
|
'Order.Item.0.Art.imprint_locations.2.description' => 'Wooo! This is Names!!',
|
||||||
|
'Order.Item.0.Art.imprint_locations.2.sizes.S.0.active' => (int) 1,
|
||||||
|
'Order.Item.0.Art.imprint_locations.2.sizes.S.0.name' => 'Benjamin Talavera',
|
||||||
|
'Order.Item.0.Art.imprint_locations.2.sizes.S.0.color' => 'Red',
|
||||||
|
'Order.Item.0.Art.imprint_locations.2.sizes.S.0.height' => '3',
|
||||||
|
'Order.Item.0.Art.imprint_locations.2.sizes.S.0.layout' => 'Arched',
|
||||||
|
'Order.Item.0.Art.imprint_locations.2.sizes.S.0.style' => 'Classic',
|
||||||
|
'Order.Item.0.Art.imprint_locations.2.sizes.S.1.active' => (int) 0,
|
||||||
|
'Order.Item.0.Art.imprint_locations.2.sizes.S.1.name' => 'Rishi Narayan',
|
||||||
|
'Order.Item.0.Art.imprint_locations.2.sizes.S.1.color' => 'Cardinal',
|
||||||
|
'Order.Item.0.Art.imprint_locations.2.sizes.S.1.height' => '4',
|
||||||
|
'Order.Item.0.Art.imprint_locations.2.sizes.S.1.layout' => 'Straight',
|
||||||
|
'Order.Item.0.Art.imprint_locations.2.sizes.S.1.style' => 'Team US',
|
||||||
|
'Order.Item.0.Art.imprint_locations.2.sizes.M.0.active' => (int) 1,
|
||||||
|
'Order.Item.0.Art.imprint_locations.2.sizes.M.0.name' => 'Brandon Plasters',
|
||||||
|
'Order.Item.0.Art.imprint_locations.2.sizes.M.0.color' => 'Red',
|
||||||
|
'Order.Item.0.Art.imprint_locations.2.sizes.M.0.height' => '3',
|
||||||
|
'Order.Item.0.Art.imprint_locations.2.sizes.M.0.layout' => 'Arched',
|
||||||
|
'Order.Item.0.Art.imprint_locations.2.sizes.M.0.style' => 'Classic',
|
||||||
|
'Order.Item.0.Art.imprint_locations.2.sizes.M.1.active' => (int) 0,
|
||||||
|
'Order.Item.0.Art.imprint_locations.2.sizes.M.1.name' => 'Andrew Reed',
|
||||||
|
'Order.Item.0.Art.imprint_locations.2.sizes.M.1.color' => 'Cardinal',
|
||||||
|
'Order.Item.0.Art.imprint_locations.2.sizes.M.1.height' => '4',
|
||||||
|
'Order.Item.0.Art.imprint_locations.2.sizes.M.1.layout' => 'Straight',
|
||||||
|
'Order.Item.0.Art.imprint_locations.2.sizes.M.1.style' => 'Team US',
|
||||||
|
'Order.Job.0._id' => 'job-1',
|
||||||
|
'Order.Job.0.type' => 'screenprinting',
|
||||||
|
'Order.Job.0.postPress' => 'job-2',
|
||||||
|
'Order.Job.1._id' => 'job-2',
|
||||||
|
'Order.Job.1.type' => 'embroidery',
|
||||||
|
'Order.Postpress' => '0',
|
||||||
|
'Order.PriceAdjustment.0._id' => 'price-adjustment-1',
|
||||||
|
'Order.PriceAdjustment.0.adjustment' => '-20',
|
||||||
|
'Order.PriceAdjustment.0.adjustment_type' => 'percent',
|
||||||
|
'Order.PriceAdjustment.0.type' => 'grand_total',
|
||||||
|
'Order.PriceAdjustment.1.adjustment' => '20',
|
||||||
|
'Order.PriceAdjustment.1.adjustment_type' => 'flat',
|
||||||
|
'Order.PriceAdjustment.1.min-items' => '10',
|
||||||
|
'Order.PriceAdjustment.1.type' => 'min-items',
|
||||||
|
'Order.PriceAdjustment.1._id' => 'another-test-adjustment',
|
||||||
|
'Order.Purchasing' => '0',
|
||||||
|
'Order.QualityControl' => '0',
|
||||||
|
'Order.Receiving' => '0',
|
||||||
|
'Order.ScreenPrinting' => '0',
|
||||||
|
'Order.Stage.art_approval' => (int) 0,
|
||||||
|
'Order.Stage.draft' => (int) 1,
|
||||||
|
'Order.Stage.quote' => (int) 1,
|
||||||
|
'Order.Stage.order' => (int) 1,
|
||||||
|
'Order.StoreLiason' => '0',
|
||||||
|
'Order.Tag_UI_Email' => '',
|
||||||
|
'Order.Tags' => '',
|
||||||
|
'Order._id' => 'test-2',
|
||||||
|
'Order.add_print_location' => '',
|
||||||
|
'Order.created' => '2011-Dec-29 05:40:18',
|
||||||
|
'Order.force_admin' => '0',
|
||||||
|
'Order.modified' => '2012-Jul-25 01:24:49',
|
||||||
|
'Order.name' => 'towering power',
|
||||||
|
'Order.order_id' => '135961',
|
||||||
|
'Order.slug' => 'test-2',
|
||||||
|
'Order.title' => 'test job 2',
|
||||||
|
'Order.type' => 'ttt'
|
||||||
|
);
|
||||||
|
$expanded = Hash::expand($data);
|
||||||
|
$flattened = Hash::flatten($expanded);
|
||||||
|
$this->assertEquals($data, $flattened);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3459,83 +3459,6 @@ class FormHelperTest extends CakeTestCase {
|
||||||
);
|
);
|
||||||
$this->assertTags($result, $expected);
|
$this->assertTags($result, $expected);
|
||||||
|
|
||||||
$result = $this->Form->input('Newsletter.subscribe', array('legend' => 'Legend title', 'type' => 'radio', 'options' => array('0' => 'Unsubscribe', '1' => 'Subscribe')));
|
|
||||||
$expected = array(
|
|
||||||
'div' => array('class' => 'input radio'),
|
|
||||||
'fieldset' => array(),
|
|
||||||
'legend' => array(),
|
|
||||||
'Legend title',
|
|
||||||
'/legend',
|
|
||||||
'input' => array('type' => 'hidden', 'name' => 'data[Newsletter][subscribe]', 'value' => '', 'id' => 'NewsletterSubscribe_'),
|
|
||||||
array('input' => array('type' => 'radio', 'name' => 'data[Newsletter][subscribe]', 'value' => '0', 'id' => 'NewsletterSubscribe0')),
|
|
||||||
array('label' => array('for' => 'NewsletterSubscribe0')),
|
|
||||||
'Unsubscribe',
|
|
||||||
'/label',
|
|
||||||
array('input' => array('type' => 'radio', 'name' => 'data[Newsletter][subscribe]', 'value' => '1', 'id' => 'NewsletterSubscribe1')),
|
|
||||||
array('label' => array('for' => 'NewsletterSubscribe1')),
|
|
||||||
'Subscribe',
|
|
||||||
'/label',
|
|
||||||
'/fieldset',
|
|
||||||
'/div'
|
|
||||||
);
|
|
||||||
$this->assertTags($result, $expected);
|
|
||||||
|
|
||||||
$result = $this->Form->input('Newsletter.subscribe', array('legend' => false, 'type' => 'radio', 'options' => array('0' => 'Unsubscribe', '1' => 'Subscribe')));
|
|
||||||
$expected = array(
|
|
||||||
'div' => array('class' => 'input radio'),
|
|
||||||
'input' => array('type' => 'hidden', 'name' => 'data[Newsletter][subscribe]', 'value' => '', 'id' => 'NewsletterSubscribe_'),
|
|
||||||
array('input' => array('type' => 'radio', 'name' => 'data[Newsletter][subscribe]', 'value' => '0', 'id' => 'NewsletterSubscribe0')),
|
|
||||||
array('label' => array('for' => 'NewsletterSubscribe0')),
|
|
||||||
'Unsubscribe',
|
|
||||||
'/label',
|
|
||||||
array('input' => array('type' => 'radio', 'name' => 'data[Newsletter][subscribe]', 'value' => '1', 'id' => 'NewsletterSubscribe1')),
|
|
||||||
array('label' => array('for' => 'NewsletterSubscribe1')),
|
|
||||||
'Subscribe',
|
|
||||||
'/label',
|
|
||||||
'/div'
|
|
||||||
);
|
|
||||||
$this->assertTags($result, $expected);
|
|
||||||
|
|
||||||
$result = $this->Form->input('Newsletter.subscribe', array('legend' => 'Legend title', 'label' => false, 'type' => 'radio', 'options' => array('0' => 'Unsubscribe', '1' => 'Subscribe')));
|
|
||||||
$expected = array(
|
|
||||||
'div' => array('class' => 'input radio'),
|
|
||||||
'fieldset' => array(),
|
|
||||||
'legend' => array(),
|
|
||||||
'Legend title',
|
|
||||||
'/legend',
|
|
||||||
'input' => array('type' => 'hidden', 'name' => 'data[Newsletter][subscribe]', 'value' => '', 'id' => 'NewsletterSubscribe_'),
|
|
||||||
array('input' => array('type' => 'radio', 'name' => 'data[Newsletter][subscribe]', 'value' => '0', 'id' => 'NewsletterSubscribe0')),
|
|
||||||
'Unsubscribe',
|
|
||||||
array('input' => array('type' => 'radio', 'name' => 'data[Newsletter][subscribe]', 'value' => '1', 'id' => 'NewsletterSubscribe1')),
|
|
||||||
'Subscribe',
|
|
||||||
'/fieldset',
|
|
||||||
'/div'
|
|
||||||
);
|
|
||||||
$this->assertTags($result, $expected);
|
|
||||||
|
|
||||||
$result = $this->Form->input('Newsletter.subscribe', array('legend' => false, 'label' => false, 'type' => 'radio', 'options' => array('0' => 'Unsubscribe', '1' => 'Subscribe')));
|
|
||||||
$expected = array(
|
|
||||||
'div' => array('class' => 'input radio'),
|
|
||||||
'input' => array('type' => 'hidden', 'name' => 'data[Newsletter][subscribe]', 'value' => '', 'id' => 'NewsletterSubscribe_'),
|
|
||||||
array('input' => array('type' => 'radio', 'name' => 'data[Newsletter][subscribe]', 'value' => '0', 'id' => 'NewsletterSubscribe0')),
|
|
||||||
'Unsubscribe',
|
|
||||||
array('input' => array('type' => 'radio', 'name' => 'data[Newsletter][subscribe]', 'value' => '1', 'id' => 'NewsletterSubscribe1')),
|
|
||||||
'Subscribe',
|
|
||||||
'/div'
|
|
||||||
);
|
|
||||||
$this->assertTags($result, $expected);
|
|
||||||
|
|
||||||
$result = $this->Form->input('Newsletter.subscribe', array('legend' => false, 'label' => false, 'type' => 'radio', 'value' => '1', 'options' => array('0' => 'Unsubscribe', '1' => 'Subscribe')));
|
|
||||||
$expected = array(
|
|
||||||
'div' => array('class' => 'input radio'),
|
|
||||||
array('input' => array('type' => 'radio', 'name' => 'data[Newsletter][subscribe]', 'value' => '0', 'id' => 'NewsletterSubscribe0')),
|
|
||||||
'Unsubscribe',
|
|
||||||
array('input' => array('type' => 'radio', 'name' => 'data[Newsletter][subscribe]', 'value' => '1', 'id' => 'NewsletterSubscribe1', 'checked' => 'checked')),
|
|
||||||
'Subscribe',
|
|
||||||
'/div'
|
|
||||||
);
|
|
||||||
$this->assertTags($result, $expected);
|
|
||||||
|
|
||||||
$result = $this->Form->radio('Employee.gender', array('male' => 'Male', 'female' => 'Female'));
|
$result = $this->Form->radio('Employee.gender', array('male' => 'Male', 'female' => 'Female'));
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'fieldset' => array(),
|
'fieldset' => array(),
|
||||||
|
@ -3655,10 +3578,11 @@ class FormHelperTest extends CakeTestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test that radios with a 0 value are selected under the correct conditions.
|
* Test that radios with a 0 value are selected under the correct conditions.
|
||||||
|
* Also ensure that values that are booleanish are handled correctly.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function testRadioOptionWithZeroValue() {
|
public function testRadioOptionWithBooleanishValues() {
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'fieldset' => array(),
|
'fieldset' => array(),
|
||||||
'legend' => array(),
|
'legend' => array(),
|
||||||
|
@ -3680,6 +3604,9 @@ class FormHelperTest extends CakeTestCase {
|
||||||
$result = $this->Form->radio('Model.field', array('1' => 'Yes', '0' => 'No'), array('value' => 0));
|
$result = $this->Form->radio('Model.field', array('1' => 'Yes', '0' => 'No'), array('value' => 0));
|
||||||
$this->assertTags($result, $expected);
|
$this->assertTags($result, $expected);
|
||||||
|
|
||||||
|
$result = $this->Form->radio('Model.field', array('1' => 'Yes', '0' => 'No'), array('value' => false));
|
||||||
|
$this->assertTags($result, $expected);
|
||||||
|
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'fieldset' => array(),
|
'fieldset' => array(),
|
||||||
'legend' => array(),
|
'legend' => array(),
|
||||||
|
@ -3704,6 +3631,30 @@ class FormHelperTest extends CakeTestCase {
|
||||||
|
|
||||||
$result = $this->Form->radio('Model.field', array('1' => 'Yes', '0' => 'No'));
|
$result = $this->Form->radio('Model.field', array('1' => 'Yes', '0' => 'No'));
|
||||||
$this->assertTags($result, $expected);
|
$this->assertTags($result, $expected);
|
||||||
|
|
||||||
|
$expected = array(
|
||||||
|
'fieldset' => array(),
|
||||||
|
'legend' => array(),
|
||||||
|
'Field',
|
||||||
|
'/legend',
|
||||||
|
array('input' => array('type' => 'radio', 'name' => 'data[Model][field]', 'checked' => 'checked', 'value' => '1', 'id' => 'ModelField1')),
|
||||||
|
array('label' => array('for' => 'ModelField1')),
|
||||||
|
'Yes',
|
||||||
|
'/label',
|
||||||
|
array('input' => array('type' => 'radio', 'name' => 'data[Model][field]', 'value' => '0', 'id' => 'ModelField0')),
|
||||||
|
array('label' => array('for' => 'ModelField0')),
|
||||||
|
'No',
|
||||||
|
'/label',
|
||||||
|
'/fieldset'
|
||||||
|
);
|
||||||
|
$result = $this->Form->radio('Model.field', array('1' => 'Yes', '0' => 'No'), array('value' => 1));
|
||||||
|
$this->assertTags($result, $expected);
|
||||||
|
|
||||||
|
$result = $this->Form->radio('Model.field', array('1' => 'Yes', '0' => 'No'), array('value' => '1'));
|
||||||
|
$this->assertTags($result, $expected);
|
||||||
|
|
||||||
|
$result = $this->Form->radio('Model.field', array('1' => 'Yes', '0' => 'No'), array('value' => true));
|
||||||
|
$this->assertTags($result, $expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -215,6 +215,18 @@ class JqueryEngineHelperTest extends CakeTestCase {
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test that querystring arguments are not double escaped.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testRequestWithQueryStringArguments() {
|
||||||
|
$url = '/users/search/sort:User.name/direction:desc?nome=&cpm=&audience=public';
|
||||||
|
$result = $this->Jquery->request($url);
|
||||||
|
$expected = '$.ajax({url:"\\/users\\/search\\/sort:User.name\\/direction:desc?nome=&cpm=&audience=public"});';
|
||||||
|
$this->assertEquals($expected, $result);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test that alternate jQuery object values work for request()
|
* test that alternate jQuery object values work for request()
|
||||||
*
|
*
|
||||||
|
|
|
@ -300,7 +300,7 @@ class ViewTest extends CakeTestCase {
|
||||||
$this->Controller->params['pass'] = array('home');
|
$this->Controller->params['pass'] = array('home');
|
||||||
|
|
||||||
$ThemeView = new TestThemeView($this->Controller);
|
$ThemeView = new TestThemeView($this->Controller);
|
||||||
$ThemeView->theme = 'TestTheme';
|
$ThemeView->theme = 'test_theme';
|
||||||
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Pages' . DS . 'home.ctp';
|
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Pages' . DS . 'home.ctp';
|
||||||
$result = $ThemeView->getViewFileName('home');
|
$result = $ThemeView->getViewFileName('home');
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
@ -309,6 +309,7 @@ class ViewTest extends CakeTestCase {
|
||||||
$result = $ThemeView->getViewFileName('/Posts/index');
|
$result = $ThemeView->getViewFileName('/Posts/index');
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
|
$ThemeView->theme = 'TestTheme';
|
||||||
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Layouts' . DS . 'default.ctp';
|
$expected = CAKE . 'Test' . DS . 'test_app' . DS . 'View' . DS . 'Themed' . DS . 'TestTheme' . DS . 'Layouts' . DS . 'default.ctp';
|
||||||
$result = $ThemeView->getLayoutFileName();
|
$result = $ThemeView->getLayoutFileName();
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
@ -546,11 +547,7 @@ class ViewTest extends CakeTestCase {
|
||||||
$this->ThemeController->params['pass'] = array('home');
|
$this->ThemeController->params['pass'] = array('home');
|
||||||
|
|
||||||
$View = new TestThemeView($this->ThemeController);
|
$View = new TestThemeView($this->ThemeController);
|
||||||
ob_start();
|
$View->getViewFileName('does_not_exist');
|
||||||
$result = $View->getViewFileName('does_not_exist');
|
|
||||||
$expected = ob_get_clean();
|
|
||||||
$this->assertRegExp("/PagesController::/", $expected);
|
|
||||||
$this->assertRegExp("/views(\/|\\\)themed(\/|\\\)my_theme(\/|\\\)pages(\/|\\\)does_not_exist.ctp/", $expected);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -577,11 +574,7 @@ class ViewTest extends CakeTestCase {
|
||||||
$this->ThemeController->theme = 'my_theme';
|
$this->ThemeController->theme = 'my_theme';
|
||||||
|
|
||||||
$View = new TestThemeView($this->ThemeController);
|
$View = new TestThemeView($this->ThemeController);
|
||||||
ob_start();
|
|
||||||
$result = $View->getLayoutFileName();
|
$result = $View->getLayoutFileName();
|
||||||
$expected = ob_get_clean();
|
|
||||||
$this->assertRegExp("/Missing Layout/", $expected);
|
|
||||||
$this->assertRegExp("/views(\/|\\\)themed(\/|\\\)my_theme(\/|\\\)layouts(\/|\\\)whatever.ctp/", $expected);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -204,19 +204,16 @@ class CakeFixtureManager {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$nested = $test->db->useNestedTransactions;
|
|
||||||
$test->db->useNestedTransactions = false;
|
|
||||||
$test->db->begin();
|
|
||||||
foreach ($fixtures as $f) {
|
foreach ($fixtures as $f) {
|
||||||
if (!empty($this->_loaded[$f])) {
|
if (!empty($this->_loaded[$f])) {
|
||||||
$fixture = $this->_loaded[$f];
|
$fixture = $this->_loaded[$f];
|
||||||
$db = ConnectionManager::getDataSource($fixture->useDbConfig);
|
$db = ConnectionManager::getDataSource($fixture->useDbConfig);
|
||||||
|
$db->begin();
|
||||||
$this->_setupTable($fixture, $db, $test->dropTables);
|
$this->_setupTable($fixture, $db, $test->dropTables);
|
||||||
$fixture->insert($db);
|
$fixture->insert($db);
|
||||||
|
$db->commit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$test->db->commit();
|
|
||||||
$test->db->useNestedTransactions = $nested;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -532,6 +532,7 @@ class Hash {
|
||||||
$stack[] = array($data, $path);
|
$stack[] = array($data, $path);
|
||||||
}
|
}
|
||||||
$data = $element;
|
$data = $element;
|
||||||
|
reset($data);
|
||||||
$path .= $key . $separator;
|
$path .= $key . $separator;
|
||||||
} else {
|
} else {
|
||||||
$result[$path . $key] = $element;
|
$result[$path . $key] = $element;
|
||||||
|
@ -539,6 +540,7 @@ class Hash {
|
||||||
|
|
||||||
if (empty($data) && !empty($stack)) {
|
if (empty($data) && !empty($stack)) {
|
||||||
list($data, $path) = array_pop($stack);
|
list($data, $path) = array_pop($stack);
|
||||||
|
reset($data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
|
|
|
@ -563,7 +563,7 @@ class String {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
foreach ($droppedTags as $closingTag) {
|
foreach ($droppedTags as $closingTag) {
|
||||||
array_push($openTags, $closingTag[1]);
|
$openTags[] = $closingTag[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1485,6 +1485,10 @@ class FormHelper extends AppHelper {
|
||||||
$hiddenField = isset($attributes['hiddenField']) ? $attributes['hiddenField'] : true;
|
$hiddenField = isset($attributes['hiddenField']) ? $attributes['hiddenField'] : true;
|
||||||
unset($attributes['hiddenField']);
|
unset($attributes['hiddenField']);
|
||||||
|
|
||||||
|
if (isset($value) && is_bool($value)) {
|
||||||
|
$value = $value ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($options as $optValue => $optTitle) {
|
foreach ($options as $optValue => $optTitle) {
|
||||||
$optionsHere = array('value' => $optValue);
|
$optionsHere = array('value' => $optValue);
|
||||||
|
|
||||||
|
|
|
@ -250,7 +250,7 @@ class JqueryEngineHelper extends JsBaseEngineHelper {
|
||||||
* @see JsBaseEngineHelper::request() for options list.
|
* @see JsBaseEngineHelper::request() for options list.
|
||||||
*/
|
*/
|
||||||
public function request($url, $options = array()) {
|
public function request($url, $options = array()) {
|
||||||
$url = $this->url($url);
|
$url = html_entity_decode($this->url($url), ENT_COMPAT, Configure::read('App.encoding'));
|
||||||
$options = $this->_mapOptions('request', $options);
|
$options = $this->_mapOptions('request', $options);
|
||||||
if (isset($options['data']) && is_array($options['data'])) {
|
if (isset($options['data']) && is_array($options['data'])) {
|
||||||
$options['data'] = $this->_toQuerystring($options['data']);
|
$options['data'] = $this->_toQuerystring($options['data']);
|
||||||
|
|
|
@ -234,7 +234,7 @@ class MootoolsEngineHelper extends JsBaseEngineHelper {
|
||||||
* @return string The completed ajax call.
|
* @return string The completed ajax call.
|
||||||
*/
|
*/
|
||||||
public function request($url, $options = array()) {
|
public function request($url, $options = array()) {
|
||||||
$url = $this->url($url);
|
$url = html_entity_decode($this->url($url), ENT_COMPAT, Configure::read('App.encoding'));
|
||||||
$options = $this->_mapOptions('request', $options);
|
$options = $this->_mapOptions('request', $options);
|
||||||
$type = $data = null;
|
$type = $data = null;
|
||||||
if (isset($options['type']) || isset($options['update'])) {
|
if (isset($options['type']) || isset($options['update'])) {
|
||||||
|
|
|
@ -234,7 +234,8 @@ class PrototypeEngineHelper extends JsBaseEngineHelper {
|
||||||
* @return string The completed ajax call.
|
* @return string The completed ajax call.
|
||||||
*/
|
*/
|
||||||
public function request($url, $options = array()) {
|
public function request($url, $options = array()) {
|
||||||
$url = '"' . $this->url($url) . '"';
|
$url = html_entity_decode($this->url($url), ENT_COMPAT, Configure::read('App.encoding'));
|
||||||
|
$url = '"' . $url . '"';
|
||||||
$options = $this->_mapOptions('request', $options);
|
$options = $this->_mapOptions('request', $options);
|
||||||
$type = '.Request';
|
$type = '.Request';
|
||||||
if (isset($options['type']) && strtolower($options['type']) == 'json') {
|
if (isset($options['type']) && strtolower($options['type']) == 'json') {
|
||||||
|
|
|
@ -69,7 +69,7 @@ class ScaffoldView extends ThemeView {
|
||||||
$paths = $this->_paths($this->plugin);
|
$paths = $this->_paths($this->plugin);
|
||||||
$exts = array($this->ext);
|
$exts = array($this->ext);
|
||||||
if ($this->ext !== '.ctp') {
|
if ($this->ext !== '.ctp') {
|
||||||
array_push($exts, '.ctp');
|
$exts[] = '.ctp';
|
||||||
}
|
}
|
||||||
foreach ($exts as $ext) {
|
foreach ($exts as $ext) {
|
||||||
foreach ($paths as $path) {
|
foreach ($paths as $path) {
|
||||||
|
|
|
@ -1082,7 +1082,7 @@ class View extends Object {
|
||||||
protected function _getExtensions() {
|
protected function _getExtensions() {
|
||||||
$exts = array($this->ext);
|
$exts = array($this->ext);
|
||||||
if ($this->ext !== '.ctp') {
|
if ($this->ext !== '.ctp') {
|
||||||
array_push($exts, '.ctp');
|
$exts[] = '.ctp';
|
||||||
}
|
}
|
||||||
return $exts;
|
return $exts;
|
||||||
}
|
}
|
||||||
|
@ -1135,13 +1135,14 @@ class View extends Object {
|
||||||
|
|
||||||
$paths = array_unique(array_merge($paths, $viewPaths));
|
$paths = array_unique(array_merge($paths, $viewPaths));
|
||||||
if (!empty($this->theme)) {
|
if (!empty($this->theme)) {
|
||||||
|
$theme = Inflector::camelize($this->theme);
|
||||||
$themePaths = array();
|
$themePaths = array();
|
||||||
foreach ($paths as $path) {
|
foreach ($paths as $path) {
|
||||||
if (strpos($path, DS . 'Plugin' . DS) === false) {
|
if (strpos($path, DS . 'Plugin' . DS) === false) {
|
||||||
if ($plugin) {
|
if ($plugin) {
|
||||||
$themePaths[] = $path . 'Themed' . DS . $this->theme . DS . 'Plugin' . DS . $plugin . DS;
|
$themePaths[] = $path . 'Themed' . DS . $theme . DS . 'Plugin' . DS . $plugin . DS;
|
||||||
}
|
}
|
||||||
$themePaths[] = $path . 'Themed' . DS . $this->theme . DS;
|
$themePaths[] = $path . 'Themed' . DS . $theme . DS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$paths = array_merge($themePaths, $paths);
|
$paths = array_merge($themePaths, $paths);
|
||||||
|
|
Loading…
Reference in a new issue