From: Go MAEDA Date: Sat, 13 Mar 2021 01:16:10 +0000 (+0000) Subject: Add test for 4 byte characters (emoji) support (#32054). X-Git-Tag: 4.2.0~57 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=73648a0b9c39aa69593b72aa629dc3cf2f6fdbf6;p=redmine.git Add test for 4 byte characters (emoji) support (#32054). Patch by Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@20780 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/test/test_helper.rb b/test/test_helper.rb index 86801ff54..6bde730af 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -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("/") diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb index 4a7c663b5..1fe42a3d8 100644 --- a/test/unit/issue_test.rb +++ b/test/unit/issue_test.rb @@ -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