mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Removed unnecessary conditional branch, fixed test and comment.
This commit is contained in:
parent
67f256297d
commit
781430c4af
2 changed files with 19 additions and 12 deletions
|
@ -1418,25 +1418,34 @@ class FormHelperTest extends CakeTestCase {
|
|||
}
|
||||
|
||||
/**
|
||||
* URL, HTML and identifier - and "URL + its hash" or "URLs + their hashes".
|
||||
* Test that URL, HTML and identifer show up in their hashs.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testSecuredFormUrlHasHtmlEntityAndFragmentIdentifier() {
|
||||
public function testSecuredFormUrlHasHtmlAndIdentifer() {
|
||||
$this->Form->request['_Token'] = array('key' => 'testKey');
|
||||
|
||||
$expected = 'a0c54487c45e8eea45beb318c35fc01e6f87de29%3A';
|
||||
$expected = 'ece0693fb1b19ca116133db1832ac29baaf41ce5%3A';
|
||||
$this->Form->create('Address', array(
|
||||
'url' => array('controller' => 'articles', 'action' => 'view', 1, '?' => array('page' => 1, 'limit' => 10), '#' => 'result')
|
||||
'url' => array(
|
||||
'controller' => 'articles',
|
||||
'action' => 'view',
|
||||
'?' => array(
|
||||
'page' => 1,
|
||||
'limit' => 10,
|
||||
'html' => '<>"',
|
||||
),
|
||||
'#' => 'result',
|
||||
),
|
||||
));
|
||||
$result = $this->Form->secure();
|
||||
$this->assertContains($expected, $result);
|
||||
|
||||
$this->Form->create('Address', array('url' => 'http://localhost/articles/view/1?page=1&limit=10#result'));
|
||||
$this->Form->create('Address', array('url' => 'http://localhost/articles/view?page=1&limit=10&html=%3C%3E%22#result'));
|
||||
$result = $this->Form->secure();
|
||||
$this->assertContains($expected, $result, 'Full URL should only use path and query.');
|
||||
|
||||
$this->Form->create('Address', array('url' => '/articles/view/1?page=1&limit=10#result'));
|
||||
$this->Form->create('Address', array('url' => '/articles/view?page=1&limit=10&html=%3C%3E%22#result'));
|
||||
$result = $this->Form->secure();
|
||||
$this->assertContains($expected, $result, 'URL path + query should work.');
|
||||
}
|
||||
|
|
|
@ -3002,19 +3002,17 @@ class FormHelper extends AppHelper {
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the last creaated form action.
|
||||
* Sets the last created form action.
|
||||
*
|
||||
* @var mixed
|
||||
* @return void
|
||||
*/
|
||||
protected function _lastAction($url) {
|
||||
$action = Router::url($url, true);
|
||||
if (strpos($action, '://')) {
|
||||
$query = parse_url($action, PHP_URL_QUERY);
|
||||
$query = $query ? '?' . $query : '';
|
||||
$this->_lastAction = parse_url($action, PHP_URL_PATH) . $query;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set/Get inputDefaults for form elements
|
||||
|
|
Loading…
Reference in a new issue