From 204093007aeeb87329fa06c8dd9a4fd8df94a85f Mon Sep 17 00:00:00 2001 From: Max Kanat-Alexander Date: Sat, 2 Oct 2010 10:03:12 -0700 Subject: Bug 601376: Test the __all__, __open__, and __closed__ arguments to bug_status in xt/search.t r=mkanat, a=mkanat (module owner) --- xt/lib/Bugzilla/Test/Search/FieldTestNormal.pm | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'xt/lib/Bugzilla/Test/Search/FieldTestNormal.pm') 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 { -- cgit v1.2.3-24-g4f1b