MDL-83617 gradereport_grader: Fix URL encoding
When changing the number of grades per page, the redirect url was encoded twice.
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
issueNumber: MDL-83617
|
||||
notes:
|
||||
tool_behat:
|
||||
- message: >
|
||||
New Behat step `\behat_general::the_url_should_match()` has been added
|
||||
to allow checking the current URL. You can use it to check whether a
|
||||
user has been redirected to the expected location.
|
||||
|
||||
e.g. `And the url should match "/mod/forum/view\.php\?id=[0-9]+"`
|
||||
type: improved
|
||||
@@ -204,7 +204,7 @@ if ($numusers > $maxusers) {
|
||||
}
|
||||
|
||||
$perpagedata = [
|
||||
'baseurl' => new moodle_url('/grade/report/grader/index.php', ['id' => s($courseid), 'report' => 'grader']),
|
||||
'baseurl' => (new moodle_url('/grade/report/grader/index.php', ['id' => s($courseid), 'report' => 'grader']))->out(false),
|
||||
'options' => []
|
||||
];
|
||||
foreach ($pagingoptions as $key => $name) {
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
</label>
|
||||
{{#js}}
|
||||
document.getElementById('{{uniqid}}').addEventListener('change', function(e) {
|
||||
var url = new URL('{{baseurl}}');
|
||||
var url = new URL('{{{baseurl}}}');
|
||||
url.searchParams.set('perpage', e.target.value);
|
||||
|
||||
window.location.href = url;
|
||||
|
||||
@@ -67,6 +67,7 @@ Feature: grader report pagination
|
||||
Then I should see "103" node occurrences of type "tr" in the "user-grades" "table"
|
||||
And I should see "2" in the ".stickyfooter .pagination" "css_element"
|
||||
And I should not see "3" in the ".stickyfooter .pagination" "css_element"
|
||||
And the url should match "/grade/report/grader/index\.php\?id=[0-9]+&report=grader&perpage=100$"
|
||||
|
||||
@javascript
|
||||
Scenario: The pagination bar is only displayed when there is more than one page
|
||||
|
||||
@@ -99,6 +99,26 @@ class behat_general extends behat_base {
|
||||
$this->execute('behat_general::i_visit', ['/course/index.php']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks, that current page PATH matches regular expression
|
||||
*
|
||||
* Example: Then the url should match "/course/index\.php"
|
||||
* Example: Then the url should match "/mod/forum/view\.php\?id=[0-9]+"
|
||||
* Example: And the url should match "^http://moodle\.org"
|
||||
*
|
||||
* @Then /^the url should match (?P<pattern>"(?:[^"]|\\")*")$/
|
||||
* @param string $pattern The pattern that must match to the current url.
|
||||
*/
|
||||
public function the_url_should_match($pattern) {
|
||||
$url = $this->getSession()->getCurrentUrl();
|
||||
|
||||
if (preg_match($pattern, $url) === 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
throw new ExpectationException(sprintf('The url "%s" should match with %s', $url, $pattern), $this->getSession());
|
||||
}
|
||||
|
||||
/**
|
||||
* Reloads the current page.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user