Skip to content

Commit

Permalink
Merge branch 'MDL-70941-master' of git://github.com/dravek/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
stronk7 committed Mar 1, 2021
2 parents 537905a + 9b8c45e commit bd2efca
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion contentbank/classes/content.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public function update_content(): bool {
*/
public function set_name(string $name): bool {
$name = trim($name);
if (empty($name)) {
if ($name === '') {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion contentbank/classes/external/rename_content.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public static function execute(int $contentid, string $name): array {
$params['name'] = clean_param($params['name'], PARAM_TEXT);

// If name is empty don't try to rename and return a more detailed message.
if (empty(trim($params['name']))) {
if (trim($params['name']) === '') {
$warnings[] = [
'item' => $params['contentid'],
'warningcode' => 'emptynamenotallowed',
Expand Down
1 change: 1 addition & 0 deletions contentbank/tests/contenttype_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ public function rename_content_provider() {
'Too long name' => [str_repeat('a', 300), str_repeat('a', 255), true],
'Empty name' => ['', 'Test content ', false],
'Blanks only' => [' ', 'Test content ', false],
'Zero name' => ['0', '0', true],
];
}

Expand Down
1 change: 1 addition & 0 deletions contentbank/tests/external/rename_content_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public function rename_content_provider() {
'Too long name' => [str_repeat('a', 300), str_repeat('a', 255), true],
'Empty name' => ['', 'Test content ', false],
'Blanks only' => [' ', 'Test content ', false],
'Zero name' => ['0', '0', true],
];
}

Expand Down

0 comments on commit bd2efca

Please sign in to comment.