Bugzilla – Attachment 66365 Details for
Bug 19130
K::A::Booksellers->search broken for attribute 'name'
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19130: Remove ->search() overloading and adjust tests
Bug-19130-Remove--search-overloading-and-adjust-te.patch (text/plain), 3.10 KB, created by
Kyle M Hall (khall)
on 2017-08-22 18:19:46 UTC
(
hide
)
Description:
Bug 19130: Remove ->search() overloading and adjust tests
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2017-08-22 18:19:46 UTC
Size:
3.10 KB
patch
obsolete
>From 3d3f5023380071c7cc13d6b8d559d3a6a28a7f0a Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 22 Aug 2017 12:01:24 -0300 >Subject: [PATCH] Bug 19130: Remove ->search() overloading and adjust tests > >This patch removes the custom ->search() function. Tests are adjusted >so the results from ->search() calls are not expected to return in the >previously hardcoded order. > >To test: >- Apply this patch >- Run: > $ sudo koha-shell kohadev > k$ cd kohaclone > k$ prove t/db_dependent/Bookseller.t >=> SUCCESS: Tests pass >- Sign off :-D > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > Koha/Acquisition/Booksellers.pm | 41 ++++++++++++++++++++++++++--------------- > t/db_dependent/Bookseller.t | 2 +- > 2 files changed, 27 insertions(+), 16 deletions(-) > >diff --git a/Koha/Acquisition/Booksellers.pm b/Koha/Acquisition/Booksellers.pm >index 5fa3540..1d1eb48 100644 >--- a/Koha/Acquisition/Booksellers.pm >+++ b/Koha/Acquisition/Booksellers.pm >@@ -1,35 +1,46 @@ > package Koha::Acquisition::Booksellers; > >-use Modern::Perl; >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it under the >+# terms of the GNU General Public License as published by the Free Software >+# Foundation; either version 3 of the License, or (at your option) any later >+# version. >+# >+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY >+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >+# A PARTICULAR PURPOSE. See the GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License along >+# with Koha; if not, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. > >-use Carp; >+use Modern::Perl; > >-use Koha::Database; >+use Koha::Acquisition::Bookseller; > > use base qw( Koha::Objects ); > >-use Koha::Acquisition::Bookseller; >+=head1 NAME > >-sub search { >- my ( $self, $params, $attributes ) = @_; >+Koha::Acquisition::Booksellers Object set class > >+=head1 API > >- while ( my ( $field, $value ) = each %$params ) { >- if ( $field eq 'name' ) { >- # Use "like" if search on name >- $params->{name} = { -like => "%$value%" }; >- } >- } >+=head2 Class Methods > >- $attributes->{order_by} ||= { -asc => 'name' }; >+=head3 _type (internal) > >- return $self->SUPER::search( $params, $attributes ); >-} >+=cut > > sub _type { > return 'Aqbookseller'; > } > >+=head3 object_class (internal) >+ >+=cut >+ > sub object_class { > return 'Koha::Acquisition::Bookseller'; > } >diff --git a/t/db_dependent/Bookseller.t b/t/db_dependent/Bookseller.t >index 96e0837..94293ac 100644 >--- a/t/db_dependent/Bookseller.t >+++ b/t/db_dependent/Bookseller.t >@@ -129,7 +129,7 @@ for my $bookseller ( @booksellers ) { > > $sample_supplier1->{id} = $id_supplier1; > is( scalar(@booksellers), $count + 2, "Get Supplier1 and Supplier2" ); >-my @tab = ( $sample_supplier1, $sample_supplier2 ); >+my @tab = ( $sample_supplier2, $sample_supplier1 ); > is_deeply( \@booksellers, \@tab, > "Returns right fields of Supplier1 and Supplier2" ); > >-- >2.10.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 19130
:
66348
|
66349
|
66350
|
66352
|
66365
|
66366
|
66367
|
66368
|
66480
|
66481
|
66482
|
66483