Skip to content
Permalink
Browse files

MDL-39216 url: new moodle_url tests for valueless params

  • Loading branch information...
Sam Hemelryk
Sam Hemelryk committed Apr 18, 2013
1 parent cf5a329 commit 616396a6cfc631f7bc117a5f975dcbce05613e68
Showing with 21 additions and 0 deletions.
  1. +21 −0 lib/tests/weblib_test.php
@@ -137,6 +137,27 @@ function test_moodle_url_round_trip() {
$this->assertEquals($strurl, $url->out(false));
}
/**
* Test Moodle URL objects created with a param with empty value.
*/
function test_moodle_url_empty_param_values() {
$strurl = 'http://moodle.org/course/view.php?id=0';
$url = new moodle_url($strurl, array('id' => 0));
$this->assertEquals($strurl, $url->out(false));
$strurl = 'http://moodle.org/course/view.php?id=';
$url = new moodle_url($strurl, array('id' => false));
$this->assertEquals($strurl, $url->out(false));
$strurl = 'http://moodle.org/course/view.php?id=';
$url = new moodle_url($strurl, array('id' => null));
$this->assertEquals($strurl, $url->out(false));
$strurl = 'http://moodle.org/course/view.php?id=';
$url = new moodle_url($strurl);
$this->assertEquals($strurl, $url->out(false));
}
function test_moodle_url_round_trip_array_params() {
$strurl = 'http://example.com/?a%5B1%5D=1&a%5B2%5D=2';
$url = new moodle_url($strurl);

0 comments on commit 616396a

Please sign in to comment.
You can’t perform that action at this time.