Skip to content

Commit

Permalink
Add test for changing direction on multiple results
Browse files Browse the repository at this point in the history
Test that sort links on non-default models switch directions correctly.

Refs #10442
  • Loading branch information
markstory committed Mar 30, 2017
1 parent c1b1088 commit 82ee9a8
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion tests/TestCase/View/Helper/PaginatorHelperTest.php
Expand Up @@ -457,16 +457,35 @@ public function testSortLinksMultiplePagination()
'direction' => 'asc',
'page' => 1,
'scope' => 'article',
],
'Tags' => [
'current' => 1,
'count' => 100,
'prevPage' => false,
'nextPage' => true,
'pageCount' => 5,
'sort' => 'tag',
'direction' => 'asc',
'page' => 1,
'scope' => 'tags',
]
];

$result = $this->Paginator->sort('title');
$result = $this->Paginator->sort('title', 'Title', ['model' => 'Articles']);
$expected = [
'a' => ['href' => '/accounts/index?article%5Bsort%5D=title&article%5Bdirection%5D=asc'],
'Title',
'/a'
];
$this->assertHtml($expected, $result);

$result = $this->Paginator->sort('tag', 'Tag', ['model' => 'Tags']);
$expected = [
'a' => ['class' => 'asc', 'href' => '/accounts/index?tags%5Bsort%5D=tag&tags%5Bdirection%5D=desc'],
'Tag',
'/a'
];
$this->assertHtml($expected, $result);
}

/**
Expand Down

0 comments on commit 82ee9a8

Please sign in to comment.