From 2a44423afa147d8f254a9c5dc1476b3d848725ab Mon Sep 17 00:00:00 2001
From: Christoph Burschka <christoph@burschka.de>
Date: Sat, 5 Dec 2015 23:57:32 +0100
Subject: [PATCH] Issue #2629292: Test renaming a tag.

Rename a tag and check for the new name.
---
 src/Tests/XBBCodeAdminTest.php | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/Tests/XBBCodeAdminTest.php b/src/Tests/XBBCodeAdminTest.php
index 5994e4f..3bb1dc6 100644
--- a/src/Tests/XBBCodeAdminTest.php
+++ b/src/Tests/XBBCodeAdminTest.php
@@ -156,8 +156,10 @@ class XBBCodeAdminTest extends WebTestBase {
     $this->assertNoFieldChecked('edit-tags-xbbcode-tag' . $id . '-status');
     $this->assertFieldByName('tags[xbbcode_tag:' . $id . '][name]', $name);
 
+    $new_name = $this->randomMachineName();
     $edit = [
       'tags[test_plugin_id][status]' => 1,
+      'tags[test_plugin_id][name]' => $new_name,
       'tags[xbbcode_tag:test_tag_id][status]' => 1,
       'tags[xbbcode_tag:' . $id . '][status]' => 1,
     ];
@@ -171,8 +173,8 @@ class XBBCodeAdminTest extends WebTestBase {
     $this->drupalGet('filter/tips');
     $this->assertNoText('BBCode is active, but no tags are available.');
 
-    $this->assertRaw('<strong>[test_plugin]</strong>');
-    $this->assertText('[test_plugin foo=bar bar=foo]Lorem Ipsum Dolor Sit Amet[/test_plugin]');
+    $this->assertRaw("<strong>[$new_name]</strong>");
+    $this->assertText("[$new_name foo=bar bar=foo]Lorem Ipsum Dolor Sit Amet[/$new_name]");
     $this->assertRaw('<span data-foo="bar" data-bar="foo">Lorem Ipsum Dolor Sit Amet</span>');
 
     $this->assertRaw('<strong>[test_tag]</strong>');
@@ -195,7 +197,7 @@ class XBBCodeAdminTest extends WebTestBase {
       '@name' => $name,
     ]));
     $this->assertRaw('<abbr title="Test Tag Description">[test_tag]</abbr>');
-    $this->assertRaw('<abbr title="Test Plugin Description">[test_plugin]</abbr>');
+    $this->assertRaw('<abbr title="Test Plugin Description">[' . $new_name . ']</abbr>');
   }
 
 }
-- 
1.9.1

