From 1f007ca2e93aa05abdeb8ae78a59b313074abaf0 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 28 Apr 2017 12:49:05 -0400 Subject: [PATCH] Revert "Bug 18179: Forbid list context calls for Koha::Objects->find" This reverts commit a1fcf1818c8d9f23d9c870e93c41c67a27faf603. Signed-off-by: Kyle M Hall --- Koha/Objects.pm | 2 -- t/db_dependent/Koha/Objects.t | 12 +----------- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/Koha/Objects.pm b/Koha/Objects.pm index 5080e7d0aa..7e73297695 100644 --- a/Koha/Objects.pm +++ b/Koha/Objects.pm @@ -78,8 +78,6 @@ my $object = Koha::Objects->find( { keypart1 => $keypart1, keypart2 => $keypart2 sub find { my ( $self, $id ) = @_; - croak 'Cannot use "->find" in list context' if wantarray; - return unless defined($id); my $result = $self->_resultset()->find($id); diff --git a/t/db_dependent/Koha/Objects.t b/t/db_dependent/Koha/Objects.t index aa897c4054..935dc47bec 100644 --- a/t/db_dependent/Koha/Objects.t +++ b/t/db_dependent/Koha/Objects.t @@ -19,7 +19,7 @@ use Modern::Perl; -use Test::More tests => 14; +use Test::More tests => 13; use Test::Warn; use Koha::Authority::Types; @@ -43,16 +43,6 @@ my @columns = Koha::Patrons->columns; my $borrowernumber_exists = grep { /^borrowernumber$/ } @columns; is( $borrowernumber_exists, 1, 'Koha::Objects->columns should return the table columns' ); -subtest 'find' => sub { - plan tests => 2; - my $patron = $builder->build({source => 'Borrower'}); - my $patron_object = Koha::Patrons->find( $patron->{borrowernumber} ); - is( $patron_object->borrowernumber, $patron->{borrowernumber}, '->find should return the correct object' ); - - eval { my @patrons = Koha::Patrons->find( $patron->{borrowernumber} ); }; - like( $@, qr|^Cannot use "->find" in list context|, "->find should not be called in list context to avoid side-effects" ); -}; - subtest 'update' => sub { plan tests => 2; -- 2.39.5