Skip to content

Commit

Permalink
MDL-75085 external: Pass proper $required param value in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
junpataleta committed Feb 2, 2023
1 parent bdd3e5e commit e87a648
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/tests/externallib_test.php
Expand Up @@ -95,7 +95,8 @@ public function test_validate_params() {
$this->assertSame('666', $result['scalar']);

$params = array('text'=>'aaa');
$description = new \external_function_parameters(array('someid' => new \external_value(PARAM_INT, 'Some int value', false),
$description = new \external_function_parameters(array(
'someid' => new \external_value(PARAM_INT, 'Some int value', VALUE_DEFAULT),
'text' => new \external_value(PARAM_ALPHA, 'Some text value')));
$result = \external_api::validate_parameters($description, $params);
$this->assertCount(2, $result);
Expand All @@ -105,7 +106,8 @@ public function test_validate_params() {
$this->assertSame('aaa', $result['text']);

$params = array('text'=>'aaa');
$description = new \external_function_parameters(array('someid' => new \external_value(PARAM_INT, 'Some int value', false, 6),
$description = new \external_function_parameters(array(
'someid' => new \external_value(PARAM_INT, 'Some int value', VALUE_DEFAULT, 6),
'text' => new \external_value(PARAM_ALPHA, 'Some text value')));
$result = \external_api::validate_parameters($description, $params);
$this->assertCount(2, $result);
Expand Down

0 comments on commit e87a648

Please sign in to comment.