Skip to content

Commit 73648a0

Browse files
committed
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
1 parent b563549 commit 73648a0

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

test/test_helper.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,10 @@ def self.is_mysql_utf8mb4
183183
return true
184184
end
185185

186+
def is_mysql_utf8mb4
187+
self.class.is_mysql_utf8mb4
188+
end
189+
186190
def repository_path_hash(arr)
187191
hs = {}
188192
hs[:path] = arr.join("/")

test/unit/issue_test.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,17 @@ def assert_visibility_match(user, issues)
218218
assert_equal issues.collect(&:id).sort, Issue.all.select {|issue| issue.visible?(user)}.collect(&:id).sort
219219
end
220220

221+
def test_create_with_emoji_character
222+
skip if Redmine::Database.mysql? && !is_mysql_utf8mb4
223+
224+
set_language_if_valid 'en'
225+
issue = Issue.new(:project_id => 1, :tracker_id => 1,
226+
:author_id => 1, :subject => 'Group assignment',
227+
:description => 'Hello 😀')
228+
assert issue.save
229+
assert_equal 'Hello 😀', issue.description
230+
end
231+
221232
def test_visible_scope_for_anonymous
222233
# Anonymous user should see issues of public projects only
223234
issues = Issue.visible(User.anonymous).to_a

0 commit comments

Comments
 (0)