]> source.dussan.org Git - redmine.git/commitdiff
Add test for 4 byte characters (emoji) support (#32054).
authorGo MAEDA <maeda@farend.jp>
Sat, 13 Mar 2021 01:16:10 +0000 (01:16 +0000)
committerGo MAEDA <maeda@farend.jp>
Sat, 13 Mar 2021 01:16:10 +0000 (01:16 +0000)
Patch by Marius BALTEANU.

git-svn-id: http://svn.redmine.org/redmine/trunk@20780 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/test_helper.rb
test/unit/issue_test.rb

index 86801ff54cd745dc8004e21c823a019e3f63e8d4..6bde730af0391d9bda8f7cbb850b81f8d66ad6d8 100644 (file)
@@ -183,6 +183,10 @@ class ActiveSupport::TestCase
     return true
   end
 
+  def is_mysql_utf8mb4
+    self.class.is_mysql_utf8mb4
+  end
+
   def repository_path_hash(arr)
     hs = {}
     hs[:path]  = arr.join("/")
index 4a7c663b54a63260a71af8a8cbcd85bee8d0b4cc..1fe42a3d857113ee6e40d3377cdde46dad5f0ac4 100644 (file)
@@ -218,6 +218,17 @@ class IssueTest < ActiveSupport::TestCase
     assert_equal issues.collect(&:id).sort, Issue.all.select {|issue| issue.visible?(user)}.collect(&:id).sort
   end
 
+  def test_create_with_emoji_character
+    skip if Redmine::Database.mysql? && !is_mysql_utf8mb4
+
+    set_language_if_valid 'en'
+    issue = Issue.new(:project_id => 1, :tracker_id => 1,
+                      :author_id => 1, :subject => 'Group assignment',
+                      :description => 'Hello ðŸ˜€')
+    assert issue.save
+    assert_equal 'Hello ðŸ˜€', issue.description
+  end
+
   def test_visible_scope_for_anonymous
     # Anonymous user should see issues of public projects only
     issues = Issue.visible(User.anonymous).to_a