summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxjm2016-06-25 16:05:25 (GMT)
committerxjm2016-06-25 16:05:25 (GMT)
commitd9bf408715233a6212a3e64f1b759bfe72349e3b (patch)
treebc44cd0e748bfd3f5d6b7f6a10d33e2c90eef4d5
parent9e73da7be68e9cb562a41ffd93fb77db2eb0d27b (diff)
Issue #2513402 by pixelmord, cilefen, prajaankit, jcnventura, webchick, nicrodgers, Bojhan, g.oechsler, xjm, ifrik, Wim Leers: Any time a user creates a thing and saves, display a link to the thing created in the status
-rw-r--r--core/modules/aggregator/src/FeedForm.php9
-rw-r--r--core/modules/aggregator/src/Tests/AggregatorTestBase.php6
-rw-r--r--core/modules/aggregator/src/Tests/UpdateFeedItemTest.php6
-rw-r--r--core/modules/aggregator/src/Tests/UpdateFeedTest.php6
-rw-r--r--core/modules/contact/src/ContactFormEditForm.php5
-rw-r--r--core/modules/contact/src/Tests/ContactSitewideTest.php20
-rw-r--r--core/modules/contact/src/Tests/ContactStorageTest.php2
-rw-r--r--core/modules/filter/src/Tests/FilterAdminTest.php6
-rw-r--r--core/modules/forum/src/Form/ForumForm.php3
-rw-r--r--core/modules/forum/src/Tests/ForumTest.php20
-rw-r--r--core/modules/locale/src/Tests/LocaleContentTest.php6
-rw-r--r--core/modules/node/src/NodeForm.php2
-rw-r--r--core/modules/node/src/Tests/NodeCreationTest.php12
-rw-r--r--core/modules/shortcut/src/ShortcutForm.php14
-rw-r--r--core/modules/system/src/Tests/Entity/EntityTranslationFormTest.php6
-rw-r--r--core/modules/taxonomy/src/TermForm.php11
-rw-r--r--core/modules/taxonomy/src/Tests/TermTest.php7
-rw-r--r--core/modules/taxonomy/src/Tests/VocabularyPermissionsTest.php14
18 files changed, 116 insertions, 39 deletions
diff --git a/core/modules/aggregator/src/FeedForm.php b/core/modules/aggregator/src/FeedForm.php
index 39ccdfa..3447cc8 100644
--- a/core/modules/aggregator/src/FeedForm.php
+++ b/core/modules/aggregator/src/FeedForm.php
@@ -16,13 +16,16 @@ class FeedForm extends ContentEntityForm {
*/
public function save(array $form, FormStateInterface $form_state) {
$feed = $this->entity;
- if ($feed->save() == SAVED_UPDATED) {
- drupal_set_message($this->t('The feed %feed has been updated.', array('%feed' => $feed->label())));
+ $status = $feed->save();
+ $label = $feed->label();
+ $view_link = $feed->link($label, 'canonical');
+ if ($status == SAVED_UPDATED) {
+ drupal_set_message($this->t('The feed %feed has been updated.', array('%feed' => $view_link)));
$form_state->setRedirectUrl($feed->urlInfo('canonical'));
}
else {
$this->logger('aggregator')->notice('Feed %feed added.', array('%feed' => $feed->label(), 'link' => $this->l($this->t('View'), new Url('aggregator.admin_overview'))));
- drupal_set_message($this->t('The feed %feed has been added.', array('%feed' => $feed->label())));
+ drupal_set_message($this->t('The feed %feed has been added.', array('%feed' => $view_link)));
}
}
diff --git a/core/modules/aggregator/src/Tests/AggregatorTestBase.php b/core/modules/aggregator/src/Tests/AggregatorTestBase.php
index 1777fe5..15be144 100644
--- a/core/modules/aggregator/src/Tests/AggregatorTestBase.php
+++ b/core/modules/aggregator/src/Tests/AggregatorTestBase.php
@@ -61,7 +61,11 @@ abstract class AggregatorTestBase extends WebTestBase {
public function createFeed($feed_url = NULL, array $edit = array()) {
$edit = $this->getFeedEditArray($feed_url, $edit);
$this->drupalPostForm('aggregator/sources/add', $edit, t('Save'));
- $this->assertRaw(t('The feed %name has been added.', array('%name' => $edit['title[0][value]'])), format_string('The feed @name has been added.', array('@name' => $edit['title[0][value]'])));
+ $this->assertText(t('The feed @name has been added.', array('@name' => $edit['title[0][value]'])), format_string('The feed @name has been added.', array('@name' => $edit['title[0][value]'])));
+
+ // Verify that the creation message contains a link to a feed.
+ $view_link = $this->xpath('//div[@class="messages"]//a[contains(@href, :href)]', array(':href' => 'aggregator/sources/'));
+ $this->assert(isset($view_link), 'The message area contains a link to a feed');
$fid = db_query("SELECT fid FROM {aggregator_feed} WHERE title = :title AND url = :url", array(':title' => $edit['title[0][value]'], ':url' => $edit['url[0][value]']))->fetchField();
$this->assertTrue(!empty($fid), 'The feed found in database.');
diff --git a/core/modules/aggregator/src/Tests/UpdateFeedItemTest.php b/core/modules/aggregator/src/Tests/UpdateFeedItemTest.php
index c1c3df9..ae78205 100644
--- a/core/modules/aggregator/src/Tests/UpdateFeedItemTest.php
+++ b/core/modules/aggregator/src/Tests/UpdateFeedItemTest.php
@@ -35,7 +35,11 @@ class UpdateFeedItemTest extends AggregatorTestBase {
$this->assertResponse(200);
$this->drupalPostForm('aggregator/sources/add', $edit, t('Save'));
- $this->assertRaw(t('The feed %name has been added.', array('%name' => $edit['title[0][value]'])), format_string('The feed @name has been added.', array('@name' => $edit['title[0][value]'])));
+ $this->assertText(t('The feed @name has been added.', array('@name' => $edit['title[0][value]'])), format_string('The feed @name has been added.', array('@name' => $edit['title[0][value]'])));
+
+ // Verify that the creation message contains a link to a feed.
+ $view_link = $this->xpath('//div[@class="messages"]//a[contains(@href, :href)]', array(':href' => 'aggregator/sources/'));
+ $this->assert(isset($view_link), 'The message area contains a link to a feed');
$fid = db_query("SELECT fid FROM {aggregator_feed} WHERE url = :url", array(':url' => $edit['url[0][value]']))->fetchField();
$feed = Feed::load($fid);
diff --git a/core/modules/aggregator/src/Tests/UpdateFeedTest.php b/core/modules/aggregator/src/Tests/UpdateFeedTest.php
index 6bfb0f1..8c797a5 100644
--- a/core/modules/aggregator/src/Tests/UpdateFeedTest.php
+++ b/core/modules/aggregator/src/Tests/UpdateFeedTest.php
@@ -24,7 +24,11 @@ class UpdateFeedTest extends AggregatorTestBase {
$edit[$same_field] = $feed->{$same_field}->value;
}
$this->drupalPostForm('aggregator/sources/' . $feed->id() . '/configure', $edit, t('Save'));
- $this->assertRaw(t('The feed %name has been updated.', array('%name' => $edit['title[0][value]'])), format_string('The feed %name has been updated.', array('%name' => $edit['title[0][value]'])));
+ $this->assertText(t('The feed @name has been updated.', array('@name' => $edit['title[0][value]'])), format_string('The feed %name has been updated.', array('%name' => $edit['title[0][value]'])));
+
+ // Verify that the creation message contains a link to a feed.
+ $view_link = $this->xpath('//div[@class="messages"]//a[contains(@href, :href)]', array(':href' => 'aggregator/sources/'));
+ $this->assert(isset($view_link), 'The message area contains a link to a feed');
// Check feed data.
$this->assertUrl($feed->url('canonical', ['absolute' => TRUE]));
diff --git a/core/modules/contact/src/ContactFormEditForm.php b/core/modules/contact/src/ContactFormEditForm.php
index 3b7dbe3..4eacea2 100644
--- a/core/modules/contact/src/ContactFormEditForm.php
+++ b/core/modules/contact/src/ContactFormEditForm.php
@@ -130,12 +130,13 @@ class ContactFormEditForm extends EntityForm implements ContainerInjectionInterf
$contact_settings = $this->config('contact.settings');
$edit_link = $this->entity->link($this->t('Edit'));
+ $view_link = $contact_form->link($contact_form->label(), 'canonical');
if ($status == SAVED_UPDATED) {
- drupal_set_message($this->t('Contact form %label has been updated.', array('%label' => $contact_form->label())));
+ drupal_set_message($this->t('Contact form %label has been updated.', array('%label' => $view_link)));
$this->logger('contact')->notice('Contact form %label has been updated.', array('%label' => $contact_form->label(), 'link' => $edit_link));
}
else {
- drupal_set_message($this->t('Contact form %label has been added.', array('%label' => $contact_form->label())));
+ drupal_set_message($this->t('Contact form %label has been added.', array('%label' => $view_link)));
$this->logger('contact')->notice('Contact form %label has been added.', array('%label' => $contact_form->label(), 'link' => $edit_link));
}
diff --git a/core/modules/contact/src/Tests/ContactSitewideTest.php b/core/modules/contact/src/Tests/ContactSitewideTest.php
index ce69388..b049f25 100644
--- a/core/modules/contact/src/Tests/ContactSitewideTest.php
+++ b/core/modules/contact/src/Tests/ContactSitewideTest.php
@@ -127,11 +127,19 @@ class ContactSitewideTest extends WebTestBase {
$this->addContactForm($id = Unicode::strtolower($this->randomMachineName($max_length_exceeded)), $label = $this->randomMachineName($max_length_exceeded), implode(',', array($recipients[0])), '', TRUE);
$this->assertText(format_string('Machine-readable name cannot be longer than @max characters but is currently @exceeded characters long.', array('@max' => $max_length, '@exceeded' => $max_length_exceeded)));
$this->addContactForm($id = Unicode::strtolower($this->randomMachineName($max_length)), $label = $this->randomMachineName($max_length), implode(',', array($recipients[0])), '', TRUE);
- $this->assertRaw(t('Contact form %label has been added.', array('%label' => $label)));
+ $this->assertText(t('Contact form @label has been added.', array('@label' => $label)));
+
+ // Verify that the creation message contains a link to a contact form.
+ $view_link = $this->xpath('//div[@class="messages"]//a[contains(@href, :href)]', array(':href' => 'contact/'));
+ $this->assert(isset($view_link), 'The message area contains a link to a contact form.');
// Create first valid form.
$this->addContactForm($id = Unicode::strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', array($recipients[0])), '', TRUE);
- $this->assertRaw(t('Contact form %label has been added.', array('%label' => $label)));
+ $this->assertText(t('Contact form @label has been added.', array('@label' => $label)));
+
+ // Verify that the creation message contains a link to a contact form.
+ $view_link = $this->xpath('//div[@class="messages"]//a[contains(@href, :href)]', array(':href' => 'contact/'));
+ $this->assert(isset($view_link), 'The message area contains a link to a contact form.');
// Check that the form was created in site default language.
$langcode = $this->config('contact.form.' . $id)->get('langcode');
@@ -152,7 +160,7 @@ class ContactSitewideTest extends WebTestBase {
$this->assertEqual($config['recipients'], array($recipients[0], $recipients[1]));
$this->assertEqual($config['reply'], $reply);
$this->assertNotEqual($id, $this->config('contact.settings')->get('default_form'));
- $this->assertRaw(t('Contact form %label has been updated.', array('%label' => $label)));
+ $this->assertText(t('Contact form @label has been updated.', array('@label' => $label)));
// Ensure the label is displayed on the contact page for this form.
$this->drupalGet('contact/' . $id);
$this->assertText($label);
@@ -170,14 +178,14 @@ class ContactSitewideTest extends WebTestBase {
// Add more forms.
$this->addContactForm(Unicode::strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', array($recipients[0], $recipients[1])), '', FALSE);
- $this->assertRaw(t('Contact form %label has been added.', array('%label' => $label)));
+ $this->assertText(t('Contact form @label has been added.', array('@label' => $label)));
$this->addContactForm($name = Unicode::strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', array($recipients[0], $recipients[1], $recipients[2])), '', FALSE);
- $this->assertRaw(t('Contact form %label has been added.', array('%label' => $label)));
+ $this->assertText(t('Contact form @label has been added.', array('@label' => $label)));
// Try adding a form that already exists.
$this->addContactForm($name, $label, '', '', FALSE);
- $this->assertNoRaw(t('Contact form %label has been added.', array('%label' => $label)));
+ $this->assertNoText(t('Contact form @label has been added.', array('@label' => $label)));
$this->assertRaw(t('The machine-readable name is already in use. It must be unique.'));
$this->drupalLogout();
diff --git a/core/modules/contact/src/Tests/ContactStorageTest.php b/core/modules/contact/src/Tests/ContactStorageTest.php
index 0a5dbb5..6fd3edd 100644
--- a/core/modules/contact/src/Tests/ContactStorageTest.php
+++ b/core/modules/contact/src/Tests/ContactStorageTest.php
@@ -50,7 +50,7 @@ class ContactStorageTest extends ContactSitewideTest {
$this->addContactForm($id = Unicode::strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', array($mail)), '', TRUE, [
'send_a_pony' => 1,
]);
- $this->assertRaw(t('Contact form %label has been added.', array('%label' => $label)));
+ $this->assertText(t('Contact form @label has been added.', array('@label' => $label)));
// Ensure that anonymous can submit site-wide contact form.
user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, array('access site-wide contact form'));
diff --git a/core/modules/filter/src/Tests/FilterAdminTest.php b/core/modules/filter/src/Tests/FilterAdminTest.php
index abb7e80..e71b57a 100644
--- a/core/modules/filter/src/Tests/FilterAdminTest.php
+++ b/core/modules/filter/src/Tests/FilterAdminTest.php
@@ -294,7 +294,11 @@ class FilterAdminTest extends WebTestBase {
$edit['body[0][value]'] = $text;
$edit['body[0][format]'] = $basic;
$this->drupalPostForm('node/add/page', $edit, t('Save'));
- $this->assertRaw(t('Basic page %title has been created.', array('%title' => $edit['title[0][value]'])), 'Filtered node created.');
+ $this->assertText(t('Basic page @title has been created.', array('@title' => $edit['title[0][value]'])), 'Filtered node created.');
+
+ // Verify that the creation message contains a link to a node.
+ $view_link = $this->xpath('//div[@class="messages"]//a[contains(@href, :href)]', array(':href' => 'node/'));
+ $this->assert(isset($view_link), 'The message area contains a link to a node');
$node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
$this->assertTrue($node, 'Node found in database.');
diff --git a/core/modules/forum/src/Form/ForumForm.php b/core/modules/forum/src/Form/ForumForm.php
index 415fef7..30f0cf1 100644
--- a/core/modules/forum/src/Form/ForumForm.php
+++ b/core/modules/forum/src/Form/ForumForm.php
@@ -78,9 +78,10 @@ class ForumForm extends TermForm {
$route_name = $this->urlStub == 'container' ? 'entity.taxonomy_term.forum_edit_container_form' : 'entity.taxonomy_term.forum_edit_form';
$route_parameters = ['taxonomy_term' => $term->id()];
$link = $this->l($this->t('Edit'), new Url($route_name, $route_parameters));
+ $view_link = $term->link($term->getName());
switch ($status) {
case SAVED_NEW:
- drupal_set_message($this->t('Created new @type %term.', array('%term' => $term->getName(), '@type' => $this->forumFormType)));
+ drupal_set_message($this->t('Created new @type %term.', array('%term' => $view_link, '@type' => $this->forumFormType)));
$this->logger('forum')->notice('Created new @type %term.', array('%term' => $term->getName(), '@type' => $this->forumFormType, 'link' => $link));
$form_state->setValue('tid', $term->id());
break;
diff --git a/core/modules/forum/src/Tests/ForumTest.php b/core/modules/forum/src/Tests/ForumTest.php
index 1327714..df21f69 100644
--- a/core/modules/forum/src/Tests/ForumTest.php
+++ b/core/modules/forum/src/Tests/ForumTest.php
@@ -415,14 +415,18 @@ class ForumTest extends WebTestBase {
$this->drupalPostForm('admin/structure/forum/add/' . $type, $edit, t('Save'));
$this->assertResponse(200);
$type = ($type == 'container') ? 'forum container' : 'forum';
- $this->assertRaw(
+ $this->assertText(
t(
- 'Created new @type %term.',
- array('%term' => $name, '@type' => t($type))
+ 'Created new @type @term.',
+ array('@term' => $name, '@type' => t($type))
),
format_string('@type was created', array('@type' => ucfirst($type)))
);
+ // Verify that the creation message contains a link to a term.
+ $view_link = $this->xpath('//div[@class="messages"]//a[contains(@href, :href)]', array(':href' => 'term/'));
+ $this->assert(isset($view_link), 'The message area contains a link to a term');
+
// Verify forum.
$term = db_query("SELECT * FROM {taxonomy_term_field_data} t WHERE t.vid = :vid AND t.name = :name AND t.description__value = :desc AND t.default_langcode = 1", array(':vid' => $this->config('forum.settings')->get('vocabulary'), ':name' => $name, ':desc' => $description))->fetchAssoc();
$this->assertTrue(!empty($term), 'The ' . $type . ' exists in the database');
@@ -540,13 +544,17 @@ class ForumTest extends WebTestBase {
$type = t('Forum topic');
if ($container) {
- $this->assertNoRaw(t('@type %title has been created.', array('@type' => $type, '%title' => $title)), 'Forum topic was not created');
+ $this->assertNoText(t('@type @title has been created.', array('@type' => $type, '@title' => $title)), 'Forum topic was not created');
$this->assertRaw(t('The item %title is a forum container, not a forum.', array('%title' => $forum['name'])), 'Error message was shown');
return;
}
else {
- $this->assertRaw(t('@type %title has been created.', array('@type' => $type, '%title' => $title)), 'Forum topic was created');
+ $this->assertText(t('@type @title has been created.', array('@type' => $type, '@title' => $title)), 'Forum topic was created');
$this->assertNoRaw(t('The item %title is a forum container, not a forum.', array('%title' => $forum['name'])), 'No error message was shown');
+
+ // Verify that the creation message contains a link to a term.
+ $view_link = $this->xpath('//div[@class="messages"]//a[contains(@href, :href)]', array(':href' => 'term/'));
+ $this->assert(isset($view_link), 'The message area contains a link to a term');
}
// Retrieve node object, ensure that the topic was created and in the proper forum.
@@ -622,7 +630,7 @@ class ForumTest extends WebTestBase {
$edit['taxonomy_forums'] = $this->rootForum['tid'];
$edit['shadow'] = TRUE;
$this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save'));
- $this->assertRaw(t('Forum topic %title has been updated.', array('%title' => $edit['title[0][value]'])), 'Forum node was edited');
+ $this->assertText(t('Forum topic @title has been updated.', array('@title' => $edit['title[0][value]'])), 'Forum node was edited');
// Verify topic was moved to a different forum.
$forum_tid = db_query("SELECT tid FROM {forum} WHERE nid = :nid AND vid = :vid", array(
diff --git a/core/modules/locale/src/Tests/LocaleContentTest.php b/core/modules/locale/src/Tests/LocaleContentTest.php
index 07021fa..188b574 100644
--- a/core/modules/locale/src/Tests/LocaleContentTest.php
+++ b/core/modules/locale/src/Tests/LocaleContentTest.php
@@ -118,7 +118,11 @@ class LocaleContentTest extends WebTestBase {
'langcode[0][value]' => 'en',
);
$this->drupalPostForm($path, $edit, t('Save'));
- $this->assertRaw(t('%title has been updated.', array('%title' => $node_title)));
+ $this->assertText(t('@title has been updated.', array('@title' => $node_title)));
+
+ // Verify that the creation message contains a link to a node.
+ $view_link = $this->xpath('//div[@class="messages"]//a[contains(@href, :href)]', array(':href' => 'node/' . $node->id()));
+ $this->assert(isset($view_link), 'The message area contains the link to the edited node');
$this->drupalLogout();
}
diff --git a/core/modules/node/src/NodeForm.php b/core/modules/node/src/NodeForm.php
index 4d1c42c..82faab7 100644
--- a/core/modules/node/src/NodeForm.php
+++ b/core/modules/node/src/NodeForm.php
@@ -356,7 +356,7 @@ class NodeForm extends ContentEntityForm {
$node->save();
$node_link = $node->link($this->t('View'));
$context = array('@type' => $node->getType(), '%title' => $node->label(), 'link' => $node_link);
- $t_args = array('@type' => node_get_type_label($node), '%title' => $node->label());
+ $t_args = array('@type' => node_get_type_label($node), '%title' => $node->link($node->label()));
if ($insert) {
$this->logger('content')->notice('@type: added %title.', $context);
diff --git a/core/modules/node/src/Tests/NodeCreationTest.php b/core/modules/node/src/Tests/NodeCreationTest.php
index 5071056..bf3ce86 100644
--- a/core/modules/node/src/Tests/NodeCreationTest.php
+++ b/core/modules/node/src/Tests/NodeCreationTest.php
@@ -48,7 +48,11 @@ class NodeCreationTest extends NodeTestBase {
$this->drupalPostForm('node/add/page', $edit, t('Save'));
// Check that the Basic page has been created.
- $this->assertRaw(t('@post %title has been created.', array('@post' => 'Basic page', '%title' => $edit['title[0][value]'])), 'Basic page created.');
+ $this->assertText(t('@post @title has been created.', array('@post' => 'Basic page', '@title' => $edit['title[0][value]'])), 'Basic page created.');
+
+ // Verify that the creation message contains a link to a node.
+ $view_link = $this->xpath('//div[@class="messages"]//a[contains(@href, :href)]', array(':href' => 'node/'));
+ $this->assert(isset($view_link), 'The message area contains a link to a node');
// Check that the node exists in the database.
$node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
@@ -137,7 +141,11 @@ class NodeCreationTest extends NodeTestBase {
$this->assertText(t('Test page text'));
// Confirm that the node was created.
- $this->assertRaw(t('@post %title has been created.', array('@post' => 'Basic page', '%title' => $edit['title[0][value]'])));
+ $this->assertText(t('@post @title has been created.', array('@post' => 'Basic page', '@title' => $edit['title[0][value]'])));
+
+ // Verify that the creation message contains a link to a node.
+ $view_link = $this->xpath('//div[@class="messages"]//a[contains(@href, :href)]', array(':href' => 'node/'));
+ $this->assert(isset($view_link), 'The message area contains a link to a node');
}
/**
diff --git a/core/modules/shortcut/src/ShortcutForm.php b/core/modules/shortcut/src/ShortcutForm.php
index 8161a02..b87db1b 100644
--- a/core/modules/shortcut/src/ShortcutForm.php
+++ b/core/modules/shortcut/src/ShortcutForm.php
@@ -23,12 +23,22 @@ class ShortcutForm extends ContentEntityForm {
public function save(array $form, FormStateInterface $form_state) {
$entity = $this->entity;
$status = $entity->save();
+ $url = $entity->getUrl();
+ // There's an edge case where a user can have permission to
+ // 'link to any content', but has no right to access the linked page. So we
+ // check the access before showing the link.
+ if ($url->access()) {
+ $view_link = \Drupal::l($entity->getTitle(), $url);
+ }
+ else {
+ $view_link = $entity->getTitle();
+ }
if ($status == SAVED_UPDATED) {
- $message = $this->t('The shortcut %link has been updated.', array('%link' => $entity->getTitle()));
+ $message = $this->t('The shortcut %link has been updated.', array('%link' => $view_link));
}
else {
- $message = $this->t('Added a shortcut for %title.', array('%title' => $entity->getTitle()));
+ $message = $this->t('Added a shortcut for %title.', array('%title' => $view_link));
}
drupal_set_message($message);
diff --git a/core/modules/system/src/Tests/Entity/EntityTranslationFormTest.php b/core/modules/system/src/Tests/Entity/EntityTranslationFormTest.php
index 101569c..d64e019 100644
--- a/core/modules/system/src/Tests/Entity/EntityTranslationFormTest.php
+++ b/core/modules/system/src/Tests/Entity/EntityTranslationFormTest.php
@@ -86,7 +86,11 @@ class EntityTranslationFormTest extends WebTestBase {
$edit['body[0][value]'] = $this->randomMachineName(16);
$edit['langcode[0][value]'] = $langcode;
$this->drupalPostForm('node/add/page', $edit, t('Save'));
- $this->assertRaw(t('Basic page %title has been created.', array('%title' => $edit['title[0][value]'])), 'Basic page created.');
+ $this->assertText(t('Basic page @title has been created.', array('@title' => $edit['title[0][value]'])), 'Basic page created.');
+
+ // Verify that the creation message contains a link to a node.
+ $view_link = $this->xpath('//div[@class="messages"]//a[contains(@href, :href)]', array(':href' => 'node/'));
+ $this->assert(isset($view_link), 'The message area contains a link to a node');
// Check to make sure the node was created.
$node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
diff --git a/core/modules/taxonomy/src/TermForm.php b/core/modules/taxonomy/src/TermForm.php
index 17ac5c2..cf05932 100644
--- a/core/modules/taxonomy/src/TermForm.php
+++ b/core/modules/taxonomy/src/TermForm.php
@@ -123,15 +123,16 @@ class TermForm extends ContentEntityForm {
$result = $term->save();
- $link = $term->link($this->t('Edit'), 'edit-form');
+ $edit_link = $term->link($this->t('Edit'), 'edit-form');
+ $view_link = $term->link($term->getName());
switch ($result) {
case SAVED_NEW:
- drupal_set_message($this->t('Created new term %term.', array('%term' => $term->getName())));
- $this->logger('taxonomy')->notice('Created new term %term.', array('%term' => $term->getName(), 'link' => $link));
+ drupal_set_message($this->t('Created new term %term.', array('%term' => $view_link)));
+ $this->logger('taxonomy')->notice('Created new term %term.', array('%term' => $term->getName(), 'link' => $edit_link));
break;
case SAVED_UPDATED:
- drupal_set_message($this->t('Updated term %term.', array('%term' => $term->getName())));
- $this->logger('taxonomy')->notice('Updated term %term.', array('%term' => $term->getName(), 'link' => $link));
+ drupal_set_message($this->t('Updated term %term.', array('%term' => $view_link)));
+ $this->logger('taxonomy')->notice('Updated term %term.', array('%term' => $term->getName(), 'link' => $edit_link));
break;
}
diff --git a/core/modules/taxonomy/src/Tests/TermTest.php b/core/modules/taxonomy/src/Tests/TermTest.php
index 603da1f..403c28c 100644
--- a/core/modules/taxonomy/src/Tests/TermTest.php
+++ b/core/modules/taxonomy/src/Tests/TermTest.php
@@ -255,7 +255,12 @@ class TermTest extends TaxonomyTestBase {
// Save, creating the terms.
$this->drupalPostForm('node/add/article', $edit, t('Save'));
- $this->assertRaw(t('@type %title has been created.', array('@type' => t('Article'), '%title' => $edit['title[0][value]'])), 'The node was created successfully.');
+ $this->assertText(t('@type @title has been created.', array('@type' => t('Article'), '@title' => $edit['title[0][value]'])), 'The node was created successfully.');
+
+ // Verify that the creation message contains a link to a node.
+ $view_link = $this->xpath('//div[@class="messages"]//a[contains(@href, :href)]', array(':href' => 'node/'));
+ $this->assert(isset($view_link), 'The message area contains a link to a node');
+
foreach ($terms as $term) {
$this->assertText($term, 'The term was saved and appears on the node page.');
}
diff --git a/core/modules/taxonomy/src/Tests/VocabularyPermissionsTest.php b/core/modules/taxonomy/src/Tests/VocabularyPermissionsTest.php
index 5468f8a..9a5e8c0 100644
--- a/core/modules/taxonomy/src/Tests/VocabularyPermissionsTest.php
+++ b/core/modules/taxonomy/src/Tests/VocabularyPermissionsTest.php
@@ -36,7 +36,11 @@ class VocabularyPermissionsTest extends TaxonomyTestBase {
$edit['name[0][value]'] = $this->randomMachineName();
$this->drupalPostForm(NULL, $edit, t('Save'));
- $this->assertRaw(t('Created new term %name.', array('%name' => $edit['name[0][value]'])), 'Term created successfully.');
+ $this->assertText(t('Created new term @name.', array('@name' => $edit['name[0][value]'])), 'Term created successfully.');
+
+ // Verify that the creation message contains a link to a term.
+ $view_link = $this->xpath('//div[@class="messages"]//a[contains(@href, :href)]', array(':href' => 'term/'));
+ $this->assert(isset($view_link), 'The message area contains a link to a term');
$terms = taxonomy_term_load_multiple_by_name($edit['name[0][value]']);
$term = reset($terms);
@@ -48,7 +52,7 @@ class VocabularyPermissionsTest extends TaxonomyTestBase {
$edit['name[0][value]'] = $this->randomMachineName();
$this->drupalPostForm(NULL, $edit, t('Save'));
- $this->assertRaw(t('Updated term %name.', array('%name' => $edit['name[0][value]'])), 'Term updated successfully.');
+ $this->assertText(t('Updated term @name.', array('@name' => $edit['name[0][value]'])), 'Term updated successfully.');
// Delete the vocabulary.
$this->drupalGet('taxonomy/term/' . $term->id() . '/delete');
@@ -76,7 +80,11 @@ class VocabularyPermissionsTest extends TaxonomyTestBase {
$edit['name[0][value]'] = $this->randomMachineName();
$this->drupalPostForm(NULL, $edit, t('Save'));
- $this->assertRaw(t('Updated term %name.', array('%name' => $edit['name[0][value]'])), 'Term updated successfully.');
+ $this->assertText(t('Updated term @name.', array('@name' => $edit['name[0][value]'])), 'Term updated successfully.');
+
+ // Verify that the update message contains a link to a term.
+ $view_link = $this->xpath('//div[@class="messages"]//a[contains(@href, :href)]', array(':href' => 'term/'));
+ $this->assert(isset($view_link), 'The message area contains a link to a term');
// Delete the vocabulary.
$this->drupalGet('taxonomy/term/' . $term->id() . '/delete');