Bugzilla – Attachment 56148 Details for
Bug 17091
Add AUTOLOAD to Koha::Objects
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17091: Add delete to the Koha::Objects AUTOLOAD method
Bug-17091-Add-delete-to-the-KohaObjects-AUTOLOAD-m.patch (text/plain), 2.43 KB, created by
Kyle M Hall (khall)
on 2016-10-11 09:14:51 UTC
(
hide
)
Description:
Bug 17091: Add delete to the Koha::Objects AUTOLOAD method
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2016-10-11 09:14:51 UTC
Size:
2.43 KB
patch
obsolete
>From 62c2dcad28553e2611d77da2ca536c55ed362d7a Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 9 Aug 2016 16:53:27 +0100 >Subject: [PATCH] Bug 17091: Add delete to the Koha::Objects AUTOLOAD method > >Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > Koha/Objects.pm | 4 ++-- > t/db_dependent/Koha/Objects.t | 11 ++++++++++- > 2 files changed, 12 insertions(+), 3 deletions(-) > >diff --git a/Koha/Objects.pm b/Koha/Objects.pm >index dd8d221..9d4d591 100644 >--- a/Koha/Objects.pm >+++ b/Koha/Objects.pm >@@ -233,14 +233,14 @@ The autoload method is used call DBIx::Class method on a resultset. > > Important: If you plan to use one of the DBIx::Class methods you must provide > relevant tests in t/db_dependent/Koha/Objects.t >-Currently count, pager, reset and update are covered. >+Currently count, pager, reset, update and delete are covered. > > =cut > > sub AUTOLOAD { > my ( $self, @params ) = @_; > >- my @known_methods = qw( count pager reset update ); >+ my @known_methods = qw( count pager reset update delete ); > my $method = our $AUTOLOAD; > $method =~ s/.*:://; > >diff --git a/t/db_dependent/Koha/Objects.t b/t/db_dependent/Koha/Objects.t >index 8e7dc6a..46348e4 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 => 6; >+use Test::More tests => 7; > use Test::Warn; > > use Koha::Authority::Types; >@@ -67,6 +67,15 @@ subtest 'reset' => sub { > is( $patrons->reset->next->borrowernumber, $first_borrowernumber, 'Koha::Objects->reset should work as expected'); > }; > >+subtest 'delete' => sub { >+ plan tests => 2; >+ my $builder = t::lib::TestBuilder->new; >+ my $patron_1 = $builder->build({source => 'Borrower'}); >+ my $patron_2 = $builder->build({source => 'Borrower'}); >+ is( Koha::Patrons->search({ -or => { borrowernumber => [ $patron_1->{borrowernumber}, $patron_2->{borrowernumber}]}})->delete, 2, ''); >+ is( Koha::Patrons->search({ -or => { borrowernumber => [ $patron_1->{borrowernumber}, $patron_2->{borrowernumber}]}})->count, 0, ''); >+}; >+ > subtest 'not_covered_yet' => sub { > plan tests => 1; > warning_is { Koha::Patrons->search->not_covered_yet } { carped => 'The method not_covered_yet is not covered by tests' }, "If a method is not covered by tests, the AUTOLOAD method won't execute the method"; >-- >2.1.4
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 17091
:
54217
|
54218
|
54219
|
54220
|
54221
|
54223
|
54272
|
54273
|
54274
|
54275
|
54276
|
54277
|
55378
|
56142
|
56143
|
56144
|
56145
|
56146
|
56147
| 56148