diff options
author | Marius Balteanu <marius.balteanu@zitec.com> | 2022-06-28 06:49:22 +0000 |
---|---|---|
committer | Marius Balteanu <marius.balteanu@zitec.com> | 2022-06-28 06:49:22 +0000 |
commit | 9aa34eb651e2941aeae69cc3acf6e1c1b909729e (patch) | |
tree | 2f29f9f3cc11726eb32297ab0d04d74a47a6e1fb /test/unit | |
parent | 94ec29e9df148eae9178300650b31b65948688ba (diff) | |
download | redmine-9aa34eb651e2941aeae69cc3acf6e1c1b909729e.tar.gz redmine-9aa34eb651e2941aeae69cc3acf6e1c1b909729e.zip |
Merged r21686 and r21687 to 5.0-stable (#36940).
git-svn-id: https://svn.redmine.org/redmine/branches/5.0-stable@21690 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/query_test.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/unit/query_test.rb b/test/unit/query_test.rb index da8e43b90..bb097f88a 100644 --- a/test/unit/query_test.rb +++ b/test/unit/query_test.rb @@ -948,6 +948,24 @@ class QueryTest < ActiveSupport::TestCase assert_equal issue1, result.first end + def test_filter_on_chained_user_custom_field + user = User.find(2) + User.current = user + + user_cf = UserCustomField.find(4) + user_cf.update! is_filter: true + + issue_cf = IssueCustomField.create!(:field_format => 'user', :is_for_all => true, :is_filter => true, :name => 'User custom field', :tracker_ids => [1]) + issue1 = Issue.create!(:project_id => 1, :tracker_id => 1, :custom_field_values => {issue_cf.id.to_s => '2'}, :subject => 'Test', :author_id => 1) + + query = IssueQuery.new(:name => '_', :project => Project.find(1)) + query.filters = {"cf_#{issue_cf.id}.cf_#{user_cf.id}" => {:operator => '~', :values => ['01 42']}} + result = query.issues + + assert_equal 1, result.size + assert_equal issue1, result.first + end + def test_filter_on_chained_user_custom_field_of_type_float user_cf = UserCustomField.find(5) user_cf.update! is_filter: true |