mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Updating test cases for the addition of rel attributes to links generated by PaginatorHelper. Also removed rel attributes for disabled elements, as they are probably not link tags. Fixes #370
This commit is contained in:
parent
65394604a7
commit
af608f68ef
2 changed files with 31 additions and 18 deletions
|
@ -454,6 +454,7 @@ class PaginatorHelper extends AppHelper {
|
||||||
if ($this->{$check}($model)) {
|
if ($this->{$check}($model)) {
|
||||||
return $this->Html->tag($tag, $this->link($title, $url, array_merge($options, compact('escape', 'class'))));
|
return $this->Html->tag($tag, $this->link($title, $url, array_merge($options, compact('escape', 'class'))));
|
||||||
} else {
|
} else {
|
||||||
|
unset($options['rel']);
|
||||||
return $this->Html->tag($tag, $title, array_merge($options, compact('escape', 'class')));
|
return $this->Html->tag($tag, $title, array_merge($options, compact('escape', 'class')));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -460,7 +460,7 @@ class PaginatorHelperTest extends CakeTestCase {
|
||||||
$result = $this->Paginator->next('Next');
|
$result = $this->Paginator->next('Next');
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'<span',
|
'<span',
|
||||||
'a' => array('href' => '/admin/users/index/page:2', 'class' => 'next'),
|
'a' => array('href' => '/admin/users/index/page:2', 'class' => 'next', 'rel' => 'next'),
|
||||||
'Next',
|
'Next',
|
||||||
'/a',
|
'/a',
|
||||||
'/span'
|
'/span'
|
||||||
|
@ -563,7 +563,7 @@ class PaginatorHelperTest extends CakeTestCase {
|
||||||
$result = $this->Paginator->next('next', array('url' => $options));
|
$result = $this->Paginator->next('next', array('url' => $options));
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'<span',
|
'<span',
|
||||||
'a' => array('href' => '/members/posts/index/page:3', 'class' => 'next'),
|
'a' => array('href' => '/members/posts/index/page:3', 'class' => 'next', 'rel' => 'next'),
|
||||||
'next',
|
'next',
|
||||||
'/a',
|
'/a',
|
||||||
'/span'
|
'/span'
|
||||||
|
@ -573,7 +573,7 @@ class PaginatorHelperTest extends CakeTestCase {
|
||||||
$result = $this->Paginator->prev('prev', array('url' => $options));
|
$result = $this->Paginator->prev('prev', array('url' => $options));
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'<span',
|
'<span',
|
||||||
'a' => array('href' => '/members/posts/index/page:1', 'class' => 'prev'),
|
'a' => array('href' => '/members/posts/index/page:1', 'class' => 'prev', 'rel' => 'prev'),
|
||||||
'prev',
|
'prev',
|
||||||
'/a',
|
'/a',
|
||||||
'/span'
|
'/span'
|
||||||
|
@ -700,7 +700,7 @@ class PaginatorHelperTest extends CakeTestCase {
|
||||||
$result = $this->Paginator->next('Next');
|
$result = $this->Paginator->next('Next');
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'<span',
|
'<span',
|
||||||
'a' => array('href' => '/articles/index/2/page:2/foo:bar', 'class' => 'next'),
|
'a' => array('href' => '/articles/index/2/page:2/foo:bar', 'class' => 'next', 'rel' => 'next'),
|
||||||
'Next',
|
'Next',
|
||||||
'/a',
|
'/a',
|
||||||
'/span'
|
'/span'
|
||||||
|
@ -750,7 +750,7 @@ class PaginatorHelperTest extends CakeTestCase {
|
||||||
$result = $this->Paginator->prev('<< Previous', null, null, array('class' => 'disabled'));
|
$result = $this->Paginator->prev('<< Previous', null, null, array('class' => 'disabled'));
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'<span',
|
'<span',
|
||||||
'a' => array('href' => '/index/page:1', 'class' => 'prev'),
|
'a' => array('href' => '/index/page:1', 'class' => 'prev', 'rel' => 'prev'),
|
||||||
'<< Previous',
|
'<< Previous',
|
||||||
'/a',
|
'/a',
|
||||||
'/span'
|
'/span'
|
||||||
|
@ -760,7 +760,7 @@ class PaginatorHelperTest extends CakeTestCase {
|
||||||
$result = $this->Paginator->next('Next');
|
$result = $this->Paginator->next('Next');
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'<span',
|
'<span',
|
||||||
'a' => array('href' => '/index/page:3', 'class' => 'next'),
|
'a' => array('href' => '/index/page:3', 'class' => 'next', 'rel' => 'next'),
|
||||||
'Next',
|
'Next',
|
||||||
'/a',
|
'/a',
|
||||||
'/span'
|
'/span'
|
||||||
|
@ -770,7 +770,7 @@ class PaginatorHelperTest extends CakeTestCase {
|
||||||
$result = $this->Paginator->next('Next', array('tag' => 'li'));
|
$result = $this->Paginator->next('Next', array('tag' => 'li'));
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'<li',
|
'<li',
|
||||||
'a' => array('href' => '/index/page:3', 'class' => 'next'),
|
'a' => array('href' => '/index/page:3', 'class' => 'next', 'rel' => 'next'),
|
||||||
'Next',
|
'Next',
|
||||||
'/a',
|
'/a',
|
||||||
'/li'
|
'/li'
|
||||||
|
@ -780,7 +780,7 @@ class PaginatorHelperTest extends CakeTestCase {
|
||||||
$result = $this->Paginator->prev('<< Previous', array('escape' => true));
|
$result = $this->Paginator->prev('<< Previous', array('escape' => true));
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'<span',
|
'<span',
|
||||||
'a' => array('href' => '/index/page:1', 'class' => 'prev'),
|
'a' => array('href' => '/index/page:1', 'class' => 'prev', 'rel' => 'prev'),
|
||||||
'<< Previous',
|
'<< Previous',
|
||||||
'/a',
|
'/a',
|
||||||
'/span'
|
'/span'
|
||||||
|
@ -790,7 +790,7 @@ class PaginatorHelperTest extends CakeTestCase {
|
||||||
$result = $this->Paginator->prev('<< Previous', array('escape' => false));
|
$result = $this->Paginator->prev('<< Previous', array('escape' => false));
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'<span',
|
'<span',
|
||||||
'a' => array('href' => '/index/page:1', 'class' => 'prev'),
|
'a' => array('href' => '/index/page:1', 'class' => 'prev', 'rel' => 'prev'),
|
||||||
'preg:/<< Previous/',
|
'preg:/<< Previous/',
|
||||||
'/a',
|
'/a',
|
||||||
'/span'
|
'/span'
|
||||||
|
@ -858,7 +858,11 @@ class PaginatorHelperTest extends CakeTestCase {
|
||||||
$result = $this->Paginator->prev('<< Previous', null, null, array('class' => 'disabled'));
|
$result = $this->Paginator->prev('<< Previous', null, null, array('class' => 'disabled'));
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'<span',
|
'<span',
|
||||||
'a' => array('href' => '/index/page:1/limit:3/sort:Client.name/direction:DESC', 'class' => 'prev'),
|
'a' => array(
|
||||||
|
'href' => '/index/page:1/limit:3/sort:Client.name/direction:DESC',
|
||||||
|
'class' => 'prev',
|
||||||
|
'rel' => 'prev'
|
||||||
|
),
|
||||||
'<< Previous',
|
'<< Previous',
|
||||||
'/a',
|
'/a',
|
||||||
'/span'
|
'/span'
|
||||||
|
@ -868,7 +872,11 @@ class PaginatorHelperTest extends CakeTestCase {
|
||||||
$result = $this->Paginator->next('Next');
|
$result = $this->Paginator->next('Next');
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'<span',
|
'<span',
|
||||||
'a' => array('href' => '/index/page:3/limit:3/sort:Client.name/direction:DESC', 'class' => 'next'),
|
'a' => array(
|
||||||
|
'href' => '/index/page:3/limit:3/sort:Client.name/direction:DESC',
|
||||||
|
'class' => 'next',
|
||||||
|
'rel' => 'next'
|
||||||
|
),
|
||||||
'Next',
|
'Next',
|
||||||
'/a',
|
'/a',
|
||||||
'/span'
|
'/span'
|
||||||
|
@ -895,7 +903,7 @@ class PaginatorHelperTest extends CakeTestCase {
|
||||||
$result = $this->Paginator->prev('Prev');
|
$result = $this->Paginator->prev('Prev');
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'<span',
|
'<span',
|
||||||
'a' => array('href' => '/index/page:1/limit:10', 'class' => 'prev'),
|
'a' => array('href' => '/index/page:1/limit:10', 'class' => 'prev', 'rel' => 'prev'),
|
||||||
'Prev',
|
'Prev',
|
||||||
'/a',
|
'/a',
|
||||||
'/span'
|
'/span'
|
||||||
|
@ -917,7 +925,7 @@ class PaginatorHelperTest extends CakeTestCase {
|
||||||
$result = $this->Paginator->prev('Prev', array('url' => array('foo' => 'bar')));
|
$result = $this->Paginator->prev('Prev', array('url' => array('foo' => 'bar')));
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'<span',
|
'<span',
|
||||||
'a' => array('href' => '/index/12/page:1/limit:10/foo:bar', 'class' => 'prev'),
|
'a' => array('href' => '/index/12/page:1/limit:10/foo:bar', 'class' => 'prev', 'rel' => 'prev'),
|
||||||
'Prev',
|
'Prev',
|
||||||
'/a',
|
'/a',
|
||||||
'/span'
|
'/span'
|
||||||
|
@ -957,7 +965,7 @@ class PaginatorHelperTest extends CakeTestCase {
|
||||||
$result = $this->Paginator->next('Next >>', array('escape' => false));
|
$result = $this->Paginator->next('Next >>', array('escape' => false));
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'<span',
|
'<span',
|
||||||
'a' => array('href' => '/index/page:2', 'class' => 'next'),
|
'a' => array('href' => '/index/page:2', 'class' => 'next', 'rel' => 'next'),
|
||||||
'preg:/Next >>/',
|
'preg:/Next >>/',
|
||||||
'/a',
|
'/a',
|
||||||
'/span'
|
'/span'
|
||||||
|
@ -1004,7 +1012,7 @@ class PaginatorHelperTest extends CakeTestCase {
|
||||||
$result = $this->Paginator->next('Next', array('model' => 'Client'));
|
$result = $this->Paginator->next('Next', array('model' => 'Client'));
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'<span',
|
'<span',
|
||||||
'a' => array('href' => '/index/page:2', 'class' => 'next'),
|
'a' => array('href' => '/index/page:2', 'class' => 'next', 'rel' => 'next'),
|
||||||
'Next',
|
'Next',
|
||||||
'/a',
|
'/a',
|
||||||
'/span'
|
'/span'
|
||||||
|
@ -2130,7 +2138,11 @@ class PaginatorHelperTest extends CakeTestCase {
|
||||||
$result = $this->Paginator->next('Next');
|
$result = $this->Paginator->next('Next');
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'<span',
|
'<span',
|
||||||
'a' => array('href' => '/officespace/accounts/index/page:2/sort:Article.title/direction:asc', 'class' => 'next'),
|
'a' => array(
|
||||||
|
'href' => '/officespace/accounts/index/page:2/sort:Article.title/direction:asc',
|
||||||
|
'class' => 'next',
|
||||||
|
'rel' => 'next'
|
||||||
|
),
|
||||||
'Next',
|
'Next',
|
||||||
'/a',
|
'/a',
|
||||||
'/span',
|
'/span',
|
||||||
|
@ -2224,7 +2236,7 @@ class PaginatorHelperTest extends CakeTestCase {
|
||||||
$result = $this->Paginator->next('Next');
|
$result = $this->Paginator->next('Next');
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'<span',
|
'<span',
|
||||||
'a' => array('href' => '/?page=3', 'class' => 'next'),
|
'a' => array('href' => '/?page=3', 'class' => 'next', 'rel' => 'next'),
|
||||||
'Next',
|
'Next',
|
||||||
'/a',
|
'/a',
|
||||||
'/span'
|
'/span'
|
||||||
|
@ -2234,7 +2246,7 @@ class PaginatorHelperTest extends CakeTestCase {
|
||||||
$result = $this->Paginator->prev('Prev');
|
$result = $this->Paginator->prev('Prev');
|
||||||
$expected = array(
|
$expected = array(
|
||||||
'<span',
|
'<span',
|
||||||
'a' => array('href' => '/?page=1', 'class' => 'prev'),
|
'a' => array('href' => '/?page=1', 'class' => 'prev', 'rel' => 'prev'),
|
||||||
'Prev',
|
'Prev',
|
||||||
'/a',
|
'/a',
|
||||||
'/span'
|
'/span'
|
||||||
|
|
Loading…
Add table
Reference in a new issue