summaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2019-11-16 09:43:42 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2019-11-16 09:43:42 +0000
commit04d4a1a191c46e4595ed455372e86c66cf3f6ed7 (patch)
tree34dd316a160884985a167c50756abe4c443dd12e /test/unit
parent1734cbf787216931aaa85c4c9aa089d3d87dc131 (diff)
downloadredmine-04d4a1a191c46e4595ed455372e86c66cf3f6ed7.tar.gz
redmine-04d4a1a191c46e4595ed455372e86c66cf3f6ed7.zip
Merged r16196 to 3.3-stable (#15773).
git-svn-id: http://svn.redmine.org/redmine/branches/3.3-stable@19074 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/query_test.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/unit/query_test.rb b/test/unit/query_test.rb
index 54b96ea40..a4dd961ec 100644
--- a/test/unit/query_test.rb
+++ b/test/unit/query_test.rb
@@ -1820,4 +1820,21 @@ class QueryTest < ActiveSupport::TestCase
ActiveRecord::Base.default_timezone = :local # restore Redmine default
end
+ def test_filter_on_subprojects
+ query = IssueQuery.new(:name => '_', :project => Project.find(1))
+ filter_name = "subproject_id"
+ assert_include filter_name, query.available_filters.keys
+
+ # "is" operator should include issues of parent project + issues of the selected subproject
+ query.filters = {filter_name => {:operator => '=', :values => ['3']}}
+ issues = find_issues_with_query(query)
+ assert_equal [1, 2, 3, 5, 7, 8, 11, 12, 13, 14], issues.map(&:id).sort
+
+ # "is not" operator should include issues of parent project + issues of all active subprojects - issues of the selected subprojects
+ query = IssueQuery.new(:name => '_', :project => Project.find(1))
+ query.filters = {filter_name => {:operator => '!', :values => ['3']}}
+ issues = find_issues_with_query(query)
+ assert_equal [1, 2, 3, 6, 7, 8, 9, 10, 11, 12], issues.map(&:id).sort
+ end
+
end