Groups are incorrect when grouping by date without user timezone set.

git-svn-id: http://svn.redmine.org/redmine/trunk@18264 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2019-06-20 06:23:48 +00:00
parent 87e82b4894
commit 001853ef79
4 changed files with 48 additions and 7 deletions

View File

@@ -355,9 +355,12 @@ class IssuesControllerTest < Redmine::ControllerTest
end
end
def test_index_grouped_by_created_on
def test_index_grouped_by_created_on_if_time_zone_is_utc
skip unless IssueQuery.new.groupable_columns.detect {|c| c.name == :created_on}
@request.session[:user_id] = 2
User.find(2).pref.update(time_zone: 'UTC')
get :index, :params => {
:set_filter => 1,
:group_by => 'created_on'
@@ -369,6 +372,25 @@ class IssuesControllerTest < Redmine::ControllerTest
end
end
def test_index_grouped_by_created_on_if_time_zone_is_nil
skip unless IssueQuery.new.groupable_columns.detect {|c| c.name == :created_on}
current_user = User.find(2)
@request.session[:user_id] = current_user.id
current_user.pref.update(time_zone: nil)
get :index, :params => {
:set_filter => 1,
:group_by => 'created_on'
}
assert_response :success
# group_name depends on localtime
group_name = format_date(Issue.second.created_on.localtime)
assert_select 'tr.group span.name', :text => group_name do
assert_select '+ span.count', :text => '2'
end
end
def test_index_grouped_by_created_on_as_pdf
skip unless IssueQuery.new.groupable_columns.detect {|c| c.name == :created_on}