Bugzilla – Attachment 54795 Details for
Bug 17094
Methods of Koha::Object[s]-based classed should not return DBIx::Class objects
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] Bug 17094: Add delete to the Koha::Objects AUTOLOAD method
SIGNED-OFF-Bug-17094-Add-delete-to-the-KohaObjects.patch (text/plain), 2.38 KB, created by
Aleisha Amohia
on 2016-08-23 23:42:44 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 17094: Add delete to the Koha::Objects AUTOLOAD method
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2016-08-23 23:42:44 UTC
Size:
2.38 KB
patch
obsolete
>From 1c79eab5dbd23cb837f0f597805a1d8e0620f818 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] [SIGNED-OFF] Bug 17094: Add delete to the Koha::Objects > AUTOLOAD method > >Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.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 17094
:
54239
|
54240
|
54795
|
54796
|
56345