aboutsummaryrefslogtreecommitdiffstats
path: root/xt/lib/Bugzilla/Test/Search
diff options
context:
space:
mode:
authorMax Kanat-Alexander <mkanat@bugzilla.org>2010-10-02 10:03:12 -0700
committerMax Kanat-Alexander <mkanat@bugzilla.org>2010-10-02 10:03:12 -0700
commit204093007aeeb87329fa06c8dd9a4fd8df94a85f (patch)
tree9ca721cd2dd7706b2f71a1528d82e3038194c371 /xt/lib/Bugzilla/Test/Search
parentb96b7a4b70e95918190effa67520c2fbf30cdcab (diff)
downloadbugs-204093007aeeb87329fa06c8dd9a4fd8df94a85f.tar
bugs-204093007aeeb87329fa06c8dd9a4fd8df94a85f.tar.gz
bugs-204093007aeeb87329fa06c8dd9a4fd8df94a85f.tar.bz2
bugs-204093007aeeb87329fa06c8dd9a4fd8df94a85f.tar.xz
bugs-204093007aeeb87329fa06c8dd9a4fd8df94a85f.zip
Bug 601376: Test the __all__, __open__, and __closed__ arguments to
bug_status in xt/search.t r=mkanat, a=mkanat (module owner)
Diffstat (limited to 'xt/lib/Bugzilla/Test/Search')
-rw-r--r--xt/lib/Bugzilla/Test/Search/Constants.pm14
-rw-r--r--xt/lib/Bugzilla/Test/Search/FieldTest.pm2
-rw-r--r--xt/lib/Bugzilla/Test/Search/FieldTestNormal.pm20
3 files changed, 30 insertions, 6 deletions
diff --git a/xt/lib/Bugzilla/Test/Search/Constants.pm b/xt/lib/Bugzilla/Test/Search/Constants.pm
index 3c68f69d2..abe01bbd1 100644
--- a/xt/lib/Bugzilla/Test/Search/Constants.pm
+++ b/xt/lib/Bugzilla/Test/Search/Constants.pm
@@ -48,6 +48,7 @@ our @EXPORT = qw(
OR_SKIP
PG_BROKEN
SKIP_FIELDS
+ SPECIAL_PARAM_TESTS
SUBSTR_NO_FIELD_ADD
SUBSTR_SIZE
TESTS
@@ -1248,4 +1249,17 @@ use constant OR_BROKEN => {
},
};
+#################
+# Special Tests #
+#################
+
+use constant SPECIAL_PARAM_TESTS => (
+ { field => 'bug_status', operator => 'anyexact', value => '__open__',
+ contains => [5] },
+ { field => 'bug_status', operator => 'anyexact', value => '__closed__',
+ contains => [1,2,3,4] },
+ { field => 'bug_status', operator => 'anyexact', value => '__all__',
+ contains => [1,2,3,4,5] },
+);
+
1;
diff --git a/xt/lib/Bugzilla/Test/Search/FieldTest.pm b/xt/lib/Bugzilla/Test/Search/FieldTest.pm
index 98f6275fe..f73facb19 100644
--- a/xt/lib/Bugzilla/Test/Search/FieldTest.pm
+++ b/xt/lib/Bugzilla/Test/Search/FieldTest.pm
@@ -59,7 +59,7 @@ sub field_object { return $_[0]->{field_object} }
# than we need the object.
sub field {
my ($self) = @_;
- return $self->{field_name} ||= $self->field_object->name;
+ $self->{field_name} ||= $self->field_object->name;
return $self->{field_name};
}
# The Bugzilla::Test::Search object that this is a child of.
diff --git a/xt/lib/Bugzilla/Test/Search/FieldTestNormal.pm b/xt/lib/Bugzilla/Test/Search/FieldTestNormal.pm
index b42db08e2..a4b913caa 100644
--- a/xt/lib/Bugzilla/Test/Search/FieldTestNormal.pm
+++ b/xt/lib/Bugzilla/Test/Search/FieldTestNormal.pm
@@ -26,12 +26,22 @@ use strict;
use warnings;
use base qw(Bugzilla::Test::Search::FieldTest);
-# We just clone a FieldTest because that's the best for performance,
-# overall--that way we don't have to translate the value again.
+use Scalar::Util qw(blessed);
+
+# Normally, we just clone a FieldTest because that's the best for performance,
+# overall--that way we don't have to translate the value again. However,
+# sometimes (like in Bugzilla::Test::Search's direct code) we just want
+# to create a FieldTestNormal.
sub new {
- my ($class, $field_test) = @_;
- my $self = { %$field_test };
- return bless $self, $class;
+ my $class = shift;
+ my ($first_arg) = @_;
+ if (blessed $first_arg
+ and $first_arg->isa('Bugzilla::Test::Search::FieldTest'))
+ {
+ my $self = { %$first_arg };
+ return bless $self, $class;
+ }
+ return $class->SUPER::new(@_);
}
sub name {