Commit 07118859 authored by webchick's avatar webchick

Issue #2469667 by willzyx, m4olivei: Wrong message on shortcut insert/update

parent 95545a84
......@@ -27,9 +27,9 @@ class ShortcutForm extends ContentEntityForm {
*/
public function save(array $form, FormStateInterface $form_state) {
$entity = $this->entity;
$entity->save();
$status = $entity->save();
if ($entity->isNew()) {
if ($status == SAVED_UPDATED) {
$message = $this->t('The shortcut %link has been updated.', array('%link' => $entity->getTitle()));
}
else {
......
......@@ -64,6 +64,7 @@ public function testShortcutLinkAdd() {
);
$this->drupalPostForm('admin/config/user-interface/shortcut/manage/' . $set->id() . '/add-link', $form_data, t('Save'));
$this->assertResponse(200);
$this->assertText(t('Added a shortcut for @title.', array('@title' => $title)));
$saved_set = ShortcutSet::load($set->id());
$paths = $this->getShortcutInformation($saved_set, 'link');
$this->assertTrue(in_array('internal:' . $test_path, $paths), 'Shortcut created: ' . $test_path);
......@@ -152,6 +153,7 @@ public function testShortcutLinkRename() {
$titles = $this->getShortcutInformation($saved_set, 'title');
$this->assertTrue(in_array($new_link_name, $titles), 'Shortcut renamed: ' . $new_link_name);
$this->assertLink($new_link_name, 0, 'Renamed shortcut link appears on the page.');
$this->assertText(t('The shortcut @link has been updated.', array('@link' => $new_link_name)));
}
/**
......@@ -170,6 +172,7 @@ public function testShortcutLinkChangePath() {
$paths = $this->getShortcutInformation($saved_set, 'link');
$this->assertTrue(in_array('internal:' . $new_link_path, $paths), 'Shortcut path changed: ' . $new_link_path);
$this->assertLinkByHref($new_link_path, 0, 'Shortcut with new path appears on the page.');
$this->assertText(t('The shortcut @link has been updated.', array('@link' => $shortcut->getTitle())));
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment