Skip to content

Commit

Permalink
Merge branch 'MDL-59619-master' of git://github.com/jleyva/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
danpoltawski committed Jul 31, 2017
2 parents 396b97b + 84c2a87 commit 9ee4ab6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mod/data/classes/external.php
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ public static function get_fields($databaseid) {

$params = array('databaseid' => $databaseid);
$params = self::validate_parameters(self::get_fields_parameters(), $params);
$warnings = array();
$fields = $warnings = array();

list($database, $course, $cm, $context) = self::validate_database($params['databaseid']);

Expand Down
12 changes: 12 additions & 0 deletions mod/data/tests/externallib_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,18 @@ public function test_get_fields() {
}
}

/**
* Test get_fields_database_without_fields.
*/
public function test_get_fields_database_without_fields() {

$this->setUser($this->student1);
$result = mod_data_external::get_fields($this->database->id);
$result = external_api::clean_returnvalue(mod_data_external::get_fields_returns(), $result);

$this->assertEmpty($result['fields']);
}

/**
* Test search_entries.
*/
Expand Down

0 comments on commit 9ee4ab6

Please sign in to comment.