mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Merge branch '1.3-misc' of dev@code.cakephp.org:cakephp into 1.3-misc
This commit is contained in:
commit
4a08bd120d
2 changed files with 66 additions and 12 deletions
|
@ -100,6 +100,15 @@ class PaginatorHelper extends AppHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Before render callback. Overridden to merge passed args with url options.
|
||||||
|
*/
|
||||||
|
function beforeRender() {
|
||||||
|
$this->options['url'] = array_merge($this->params['pass'], $this->params['named']);
|
||||||
|
|
||||||
|
parent::beforeRender();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the current paging parameters from the resultset for the given model
|
* Gets the current paging parameters from the resultset for the given model
|
||||||
*
|
*
|
||||||
|
|
|
@ -551,6 +551,51 @@ class PaginatorHelperTest extends CakeTestCase {
|
||||||
$this->assertEqual($expected, $this->Paginator->params['paging']);
|
$this->assertEqual($expected, $this->Paginator->params['paging']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* testPassedArgsMergingWithUrlOptions method
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function testPassedArgsMergingWithUrlOptions() {
|
||||||
|
Router::reload();
|
||||||
|
Router::parse('/');
|
||||||
|
Router::setRequestInfo(array(
|
||||||
|
array('plugin' => null, 'controller' => 'articles', 'action' => 'index', 'pass' => array('2'), 'named' => array('foo' => 'bar'), 'form' => array(), 'url' => array('url' => 'articles/index/2/foo:bar'), 'bare' => 0),
|
||||||
|
array('plugin' => null, 'controller' => null, 'action' => null, 'base' => '/', 'here' => '/articles/', 'webroot' => '/', 'passedArgs' => array(0 => '2', 'foo' => 'bar'))
|
||||||
|
));
|
||||||
|
|
||||||
|
$this->Paginator->params['pass'] = array(2);
|
||||||
|
$this->Paginator->params['named'] = array('foo' => 'bar');
|
||||||
|
$this->Paginator->beforeRender();
|
||||||
|
|
||||||
|
$result = $this->Paginator->sort('title');
|
||||||
|
$expected = array(
|
||||||
|
'a' => array('href' => '/articles/index/2/page:1/foo:bar/sort:title/direction:asc'),
|
||||||
|
'Title',
|
||||||
|
'/a'
|
||||||
|
);
|
||||||
|
$this->assertTags($result, $expected);
|
||||||
|
|
||||||
|
$result = $this->Paginator->numbers();
|
||||||
|
$expected = array(
|
||||||
|
array('span' => array('class' => 'current')), '1', '/span',
|
||||||
|
' | ',
|
||||||
|
array('span' => array()), array('a' => array('href' => '/articles/index/2/page:2/foo:bar')), '2', '/a', '/span',
|
||||||
|
' | ',
|
||||||
|
array('span' => array()), array('a' => array('href' => '/articles/index/2/page:3/foo:bar')), '3', '/a', '/span',
|
||||||
|
' | ',
|
||||||
|
array('span' => array()), array('a' => array('href' => '/articles/index/2/page:4/foo:bar')), '4', '/a', '/span',
|
||||||
|
' | ',
|
||||||
|
array('span' => array()), array('a' => array('href' => '/articles/index/2/page:5/foo:bar')), '5', '/a', '/span',
|
||||||
|
' | ',
|
||||||
|
array('span' => array()), array('a' => array('href' => '/articles/index/2/page:6/foo:bar')), '6', '/a', '/span',
|
||||||
|
' | ',
|
||||||
|
array('span' => array()), array('a' => array('href' => '/articles/index/2/page:7/foo:bar')), '7', '/a', '/span',
|
||||||
|
);
|
||||||
|
$this->assertTags($result, $expected);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* testPagingLinks method
|
* testPagingLinks method
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue