Issue #1926958 by amateescu, maciej.zgadzaj, dawehner: Fixed (Regression) menu_link_save() no longer returns success/failure to calling functions.

8.0.x
webchick 2013-03-17 12:17:33 -07:00
parent a28d09eb8e
commit 30ea03aaf7
2 changed files with 9 additions and 2 deletions

View File

@ -82,7 +82,10 @@ class MenuTest extends WebTestBase {
// Verify that a change to the description is saved.
$description = $this->randomName(16);
$item['options']['attributes']['title'] = $description;
menu_link_save($item);
$return_value = menu_link_save($item);
// Save the menu link again to test the return value of the procedural save
// helper.
$this->assertIdentical($return_value, $item->save(), 'Return value of menu_link_save() is identical to the return value of $menu_link->save().');
$saved_item = entity_load('menu_link', $item['mlid']);
$this->assertEqual($description, $saved_item['options']['attributes']['title'], 'Saving an existing link updates the description (title attribute)');
$this->resetMenuLink($item, $old_title);

View File

@ -115,9 +115,13 @@ function menu_link_delete_multiple(array $mlids, $force = FALSE, $prevent_repare
*
* @param \Drupal\menu_link\Plugin\Core\Entity\MenuLink $menu_link
* The menu link entity to be saved.
*
* @return int|bool
* Returns SAVED_NEW or SAVED_UPDATED if the save operation succeeded, or
* FALSE if it failed.
*/
function menu_link_save(MenuLink $menu_link) {
$menu_link->save();
return $menu_link->save();
}
/**