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
This commit is contained in:
Go MAEDA
2021-03-13 01:16:10 +00:00
parent b5635490f2
commit 73648a0b9c
2 changed files with 15 additions and 0 deletions

View 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("/")

View 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