mirror of
https://github.com/moodle/moodle.git
synced 2025-08-08 10:26:40 +02:00
Merge branch 'w38_MDL-29401_m22_frankenstyle' of git://github.com/skodak/moodle
This commit is contained in:
commit
e135797586
50 changed files with 267 additions and 142 deletions
|
@ -693,6 +693,62 @@ class moodlelib_test extends UnitTestCase {
|
|||
',9789,42897');
|
||||
}
|
||||
|
||||
function test_clean_param_component() {
|
||||
// please note the cleaning of component names is very strict, no guessing here
|
||||
$this->assertIdentical(clean_param('mod_forum', PARAM_COMPONENT), 'mod_forum');
|
||||
$this->assertIdentical(clean_param('block_online_users', PARAM_COMPONENT), 'block_online_users');
|
||||
$this->assertIdentical(clean_param('block_blond_online_users', PARAM_COMPONENT), 'block_blond_online_users');
|
||||
$this->assertIdentical(clean_param('mod_something2', PARAM_COMPONENT), 'mod_something2');
|
||||
$this->assertIdentical(clean_param('forum', PARAM_COMPONENT), 'forum');
|
||||
$this->assertIdentical(clean_param('user', PARAM_COMPONENT), 'user');
|
||||
$this->assertIdentical(clean_param('rating', PARAM_COMPONENT), 'rating');
|
||||
$this->assertIdentical(clean_param('mod_2something', PARAM_COMPONENT), '');
|
||||
$this->assertIdentical(clean_param('2mod_something', PARAM_COMPONENT), '');
|
||||
$this->assertIdentical(clean_param('mod_something_xx', PARAM_COMPONENT), '');
|
||||
$this->assertIdentical(clean_param('auth_something__xx', PARAM_COMPONENT), '');
|
||||
$this->assertIdentical(clean_param('mod_Something', PARAM_COMPONENT), '');
|
||||
$this->assertIdentical(clean_param('mod_somethíng', PARAM_COMPONENT), '');
|
||||
$this->assertIdentical(clean_param('auth_xx-yy', PARAM_COMPONENT), '');
|
||||
$this->assertIdentical(clean_param('_auth_xx', PARAM_COMPONENT), '');
|
||||
$this->assertIdentical(clean_param('a2uth_xx', PARAM_COMPONENT), '');
|
||||
$this->assertIdentical(clean_param('auth_xx_', PARAM_COMPONENT), '');
|
||||
$this->assertIdentical(clean_param('auth_xx.old', PARAM_COMPONENT), '');
|
||||
$this->assertIdentical(clean_param('_user', PARAM_COMPONENT), '');
|
||||
$this->assertIdentical(clean_param('2rating', PARAM_COMPONENT), '');
|
||||
$this->assertIdentical(clean_param('user_', PARAM_COMPONENT), '');
|
||||
}
|
||||
|
||||
function test_clean_param_plugin() {
|
||||
// please note the cleaning of plugin names is very strict, no guessing here
|
||||
$this->assertIdentical(clean_param('forum', PARAM_PLUGIN), 'forum');
|
||||
$this->assertIdentical(clean_param('forum2', PARAM_PLUGIN), 'forum2');
|
||||
$this->assertIdentical(clean_param('online_users', PARAM_PLUGIN), 'online_users');
|
||||
$this->assertIdentical(clean_param('blond_online_users', PARAM_PLUGIN), 'blond_online_users');
|
||||
$this->assertIdentical(clean_param('online__users', PARAM_PLUGIN), '');
|
||||
$this->assertIdentical(clean_param('forum ', PARAM_PLUGIN), '');
|
||||
$this->assertIdentical(clean_param('forum.old', PARAM_PLUGIN), '');
|
||||
$this->assertIdentical(clean_param('xx-yy', PARAM_PLUGIN), '');
|
||||
$this->assertIdentical(clean_param('2xx', PARAM_PLUGIN), '');
|
||||
$this->assertIdentical(clean_param('Xx', PARAM_PLUGIN), '');
|
||||
$this->assertIdentical(clean_param('_xx', PARAM_PLUGIN), '');
|
||||
$this->assertIdentical(clean_param('xx_', PARAM_PLUGIN), '');
|
||||
}
|
||||
|
||||
function test_clean_param_area() {
|
||||
// please note the cleaning of area names is very strict, no guessing here
|
||||
$this->assertIdentical(clean_param('something', PARAM_AREA), 'something');
|
||||
$this->assertIdentical(clean_param('something2', PARAM_AREA), 'something2');
|
||||
$this->assertIdentical(clean_param('some_thing', PARAM_AREA), 'some_thing');
|
||||
$this->assertIdentical(clean_param('some_thing_xx', PARAM_AREA), 'some_thing_xx');
|
||||
$this->assertIdentical(clean_param('_something', PARAM_AREA), '');
|
||||
$this->assertIdentical(clean_param('something_', PARAM_AREA), '');
|
||||
$this->assertIdentical(clean_param('2something', PARAM_AREA), '');
|
||||
$this->assertIdentical(clean_param('Something', PARAM_AREA), '');
|
||||
$this->assertIdentical(clean_param('some-thing', PARAM_AREA), '');
|
||||
$this->assertIdentical(clean_param('somethííng', PARAM_AREA), '');
|
||||
$this->assertIdentical(clean_param('something.x', PARAM_AREA), '');
|
||||
}
|
||||
|
||||
function test_clean_param_text() {
|
||||
$this->assertEqual(PARAM_TEXT, PARAM_MULTILANG);
|
||||
//standard
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue