mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge branch 'master' into 2.5
This commit is contained in:
commit
afc8587949
7 changed files with 74 additions and 16 deletions
|
@ -1630,6 +1630,11 @@ class CakeEmail {
|
|||
$View = new $viewClass(null);
|
||||
$View->viewVars = $this->_viewVars;
|
||||
$View->helpers = $this->_helpers;
|
||||
|
||||
if ($this->_theme) {
|
||||
$View->theme = $this->_theme;
|
||||
}
|
||||
|
||||
$View->loadHelpers();
|
||||
|
||||
list($templatePlugin, $template) = pluginSplit($this->_template);
|
||||
|
@ -1639,9 +1644,7 @@ class CakeEmail {
|
|||
} elseif ($layoutPlugin) {
|
||||
$View->plugin = $layoutPlugin;
|
||||
}
|
||||
if ($this->_theme) {
|
||||
$View->theme = $this->_theme;
|
||||
}
|
||||
|
||||
// Convert null to false, as View needs false to disable
|
||||
// the layout.
|
||||
if ($layout === null) {
|
||||
|
|
|
@ -159,7 +159,7 @@ class HttpSocketResponse implements ArrayAccess {
|
|||
$this->raw = $message;
|
||||
$this->body = (string)substr($message, strlen($match[0]));
|
||||
|
||||
if (preg_match("/(.+) ([0-9]{3}) (.+)\r\n/DU", $statusLine, $match)) {
|
||||
if (preg_match("/(.+) ([0-9]{3})\s*([^ ]*)\r\n/DU", $statusLine, $match)) {
|
||||
$this->httpVersion = $match[1];
|
||||
$this->code = $match[2];
|
||||
$this->reasonPhrase = $match[3];
|
||||
|
|
|
@ -1340,6 +1340,7 @@ class CakeEmailTest extends CakeTestCase {
|
|||
$this->assertContains('In TestTheme', $result['message']);
|
||||
$this->assertContains('Message-ID: ', $result['headers']);
|
||||
$this->assertContains('To: ', $result['headers']);
|
||||
$this->assertContains('/theme/TestTheme/img/test.jpg', $result['message']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1754,4 +1754,41 @@ class HttpSocketTest extends CakeTestCase {
|
|||
$this->assertContains('Failed to enable crypto', $message);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for status codes.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function statusProvider() {
|
||||
return array(
|
||||
array('HTTP/1.1 200 '),
|
||||
array('HTTP/1.1 200 '),
|
||||
array('HTTP/1.1 200'),
|
||||
array('HTTP/1.1 200 OK', 'OK'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* test response status parsing
|
||||
*
|
||||
* @dataProvider statusProvider
|
||||
* @return void
|
||||
*/
|
||||
public function testResponseStatusParsing($status, $msg = '') {
|
||||
$this->Socket->connected = true;
|
||||
$serverResponse = $status . "\r\nDate: Mon, 16 Apr 2007 04:14:16 GMT\r\nServer: CakeHttp Server\r\n\r\n<h1>This is a test!</h1>";
|
||||
$this->Socket->expects($this->at(1))->method('read')->will($this->returnValue($serverResponse));
|
||||
$this->Socket->expects($this->at(2))->method('read')->will($this->returnValue(false));
|
||||
|
||||
$response = $this->Socket->request('http://www.cakephp.org/');
|
||||
$this->assertInstanceOf('HttpSocketResponse', $response);
|
||||
$expected = array(
|
||||
'http-version' => 'HTTP/1.1',
|
||||
'code' => '200',
|
||||
'reason-phrase' => $msg
|
||||
);
|
||||
$this->assertEquals($expected, $response['status']);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3666,18 +3666,22 @@ class FormHelperTest extends CakeTestCase {
|
|||
);
|
||||
$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'),
|
||||
array('form' => 'my-form')
|
||||
);
|
||||
$expected = array(
|
||||
'fieldset' => array(),
|
||||
'legend' => array(),
|
||||
'Gender',
|
||||
'/legend',
|
||||
'input' => array('type' => 'hidden', 'name' => 'data[Employee][gender]', 'value' => '', 'id' => 'EmployeeGender_'),
|
||||
array('input' => array('type' => 'radio', 'name' => 'data[Employee][gender]', 'value' => 'male', 'id' => 'EmployeeGenderMale')),
|
||||
'input' => array('type' => 'hidden', 'name' => 'data[Employee][gender]', 'value' => '', 'id' => 'EmployeeGender_', 'form' => 'my-form'),
|
||||
array('input' => array('type' => 'radio', 'name' => 'data[Employee][gender]', 'value' => 'male', 'id' => 'EmployeeGenderMale', 'form' => 'my-form')),
|
||||
array('label' => array('for' => 'EmployeeGenderMale')),
|
||||
'Male',
|
||||
'/label',
|
||||
array('input' => array('type' => 'radio', 'name' => 'data[Employee][gender]', 'value' => 'female', 'id' => 'EmployeeGenderFemale')),
|
||||
array('input' => array('type' => 'radio', 'name' => 'data[Employee][gender]', 'value' => 'female', 'id' => 'EmployeeGenderFemale', 'form' => 'my-form')),
|
||||
array('label' => array('for' => 'EmployeeGenderFemale')),
|
||||
'Female',
|
||||
'/label',
|
||||
|
@ -4702,15 +4706,18 @@ class FormHelperTest extends CakeTestCase {
|
|||
$this->assertTags($result, $expected);
|
||||
|
||||
$result = $this->Form->select(
|
||||
'Model.multi_field', $options, array('multiple' => 'multiple')
|
||||
'Model.multi_field', $options, array('form' => 'my-form', 'multiple' => 'multiple')
|
||||
);
|
||||
$expected = array(
|
||||
'input' => array(
|
||||
'type' => 'hidden', 'name' => 'data[Model][multi_field]', 'value' => '', 'id' => 'ModelMultiField_'
|
||||
'type' => 'hidden', 'name' => 'data[Model][multi_field]', 'value' => '', 'id' => 'ModelMultiField_',
|
||||
'form' => 'my-form',
|
||||
),
|
||||
'select' => array(
|
||||
'name' => 'data[Model][multi_field][]',
|
||||
'id' => 'ModelMultiField', 'multiple' => 'multiple'
|
||||
'id' => 'ModelMultiField',
|
||||
'multiple' => 'multiple',
|
||||
'form' => 'my-form',
|
||||
),
|
||||
array('option' => array('value' => '0')),
|
||||
'first',
|
||||
|
@ -5726,10 +5733,14 @@ class FormHelperTest extends CakeTestCase {
|
|||
);
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
$result = $this->Form->checkbox('Model.field', array('id' => 'theID', 'value' => 'myvalue'));
|
||||
$result = $this->Form->checkbox('Model.field', array(
|
||||
'id' => 'theID',
|
||||
'value' => 'myvalue',
|
||||
'form' => 'my-form',
|
||||
));
|
||||
$expected = array(
|
||||
'input' => array('type' => 'hidden', 'name' => 'data[Model][field]', 'value' => '0', 'id' => 'theID_'),
|
||||
array('input' => array('type' => 'checkbox', 'name' => 'data[Model][field]', 'value' => 'myvalue', 'id' => 'theID'))
|
||||
'input' => array('type' => 'hidden', 'name' => 'data[Model][field]', 'value' => '0', 'id' => 'theID_', 'form' => 'my-form'),
|
||||
array('input' => array('type' => 'checkbox', 'name' => 'data[Model][field]', 'value' => 'myvalue', 'id' => 'theID', 'form' => 'my-form'))
|
||||
);
|
||||
$this->assertTags($result, $expected);
|
||||
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
In TestTheme
|
||||
<?php echo $this->Html->image('test.jpg') ?>
|
|
@ -1438,7 +1438,8 @@ class FormHelper extends AppHelper {
|
|||
'id' => $options['id'] . '_',
|
||||
'name' => $options['name'],
|
||||
'value' => ($options['hiddenField'] !== true ? $options['hiddenField'] : '0'),
|
||||
'secure' => false
|
||||
'form' => isset($options['form']) ? $options['form'] : null,
|
||||
'secure' => false,
|
||||
);
|
||||
if (isset($options['disabled']) && $options['disabled']) {
|
||||
$hiddenOptions['disabled'] = 'disabled';
|
||||
|
@ -1564,7 +1565,10 @@ class FormHelper extends AppHelper {
|
|||
if ($hiddenField) {
|
||||
if (!isset($value) || $value === '') {
|
||||
$hidden = $this->hidden($fieldName, array(
|
||||
'id' => $attributes['id'] . '_', 'value' => '', 'name' => $attributes['name']
|
||||
'form' => isset($attributes['form']) ? $attributes['form'] : null,
|
||||
'id' => $attributes['id'] . '_',
|
||||
'value' => '',
|
||||
'name' => $attributes['name']
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@ -2045,6 +2049,7 @@ class FormHelper extends AppHelper {
|
|||
'value' => '',
|
||||
'id' => $attributes['id'] . ($style ? '' : '_'),
|
||||
'secure' => false,
|
||||
'form' => isset($attributes['form']) ? $attributes['form'] : null,
|
||||
'name' => $attributes['name']
|
||||
);
|
||||
$select[] = $this->hidden(null, $hiddenAttributes);
|
||||
|
|
Loading…
Reference in a new issue