mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-07 03:52:41 +00:00
Fixing issue where disallowing plugin was not possible in PaginatorHelper, fixes #6159
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@8090 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
92cc331341
commit
fdbf102228
2 changed files with 38 additions and 2 deletions
|
@ -261,7 +261,8 @@ class PaginatorHelper extends AppHelper {
|
|||
|
||||
$obj = isset($options['update']) ? 'Ajax' : 'Html';
|
||||
$url = array_merge(array('page' => $this->current($model)), $url);
|
||||
return $this->{$obj}->link($title, Set::filter($url, true), $options);
|
||||
$url = array_merge(Set::filter($url, true), array_intersect_key($url, array('plugin'=>true)));
|
||||
return $this->{$obj}->link($title, $url, $options);
|
||||
}
|
||||
/**
|
||||
* Merges passed URL options with current pagination state to generate a pagination URL.
|
||||
|
@ -642,4 +643,4 @@ class PaginatorHelper extends AppHelper {
|
|||
return $out;
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -781,6 +781,41 @@ class PaginatorTest extends CakeTestCase {
|
|||
$result = $this->Paginator->hasPage(2);
|
||||
$this->assertTrue($result);
|
||||
}
|
||||
/**
|
||||
* testWithPlugin method
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function testWithPlugin() {
|
||||
Router::reload();
|
||||
Router::setRequestInfo(array(
|
||||
array(
|
||||
'pass' => array(), 'named' => array(), 'prefix' => null, 'form' => array(),
|
||||
'controller' => 'magazines', 'plugin' => 'my_plugin', 'action' => 'index',
|
||||
'url' => array('ext' => 'html', 'url' => 'my_plugin/magazines')),
|
||||
array('base' => '', 'here' => '/my_plugin/magazines', 'webroot' => '/')
|
||||
));
|
||||
|
||||
$result = $this->Paginator->link('Page 3', array('page' => 3));
|
||||
$this->assertPattern('/["\']\/my_plugin\/magazines\/index\/page:3["\']/', $result);
|
||||
|
||||
$this->Paginator->options(array('url' => array('action' => 'another_index')));
|
||||
$result = $this->Paginator->link('Page 3', array('page' => 3));
|
||||
$this->assertPattern('/["\']\/my_plugin\/magazines\/another_index\/page:3["\']/', $result);
|
||||
|
||||
$this->Paginator->options(array('url' => array('controller' => 'issues')));
|
||||
$result = $this->Paginator->link('Page 3', array('page' => 3));
|
||||
$this->assertPattern('/["\']\/my_plugin\/issues\/index\/page:3["\']/', $result);
|
||||
|
||||
$this->Paginator->options(array('url' => array('plugin' => null)));
|
||||
$result = $this->Paginator->link('Page 3', array('page' => 3));
|
||||
$this->assertPattern('/["\']\/magazines\/index\/page:3["\']/', $result);
|
||||
|
||||
$this->Paginator->options(array('url' => array('plugin' => null, 'controller' => 'issues')));
|
||||
$result = $this->Paginator->link('Page 3', array('page' => 3));
|
||||
$this->assertPattern('/["\']\/issues\/index\/page:3["\']/', $result);
|
||||
}
|
||||
/**
|
||||
* tearDown method
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue