Bugzilla – Attachment 62396 Details for
Bug 18361
Koha::Objects->find should accept composite primary keys
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18361: Additional tests for Koha::Objects->find
Bug-18361-Additional-tests-for-KohaObjects-find.patch (text/plain), 2.33 KB, created by
Tomás Cohen Arazi (tcohen)
on 2017-04-19 15:37:01 UTC
(
hide
)
Description:
Bug 18361: Additional tests for Koha::Objects->find
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2017-04-19 15:37:01 UTC
Size:
2.33 KB
patch
obsolete
>From 1638db343ed513317bcecc1fe81c8e9f65fd0a14 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 13 Apr 2017 13:15:30 +0200 >Subject: [PATCH] Bug 18361: Additional tests for Koha::Objects->find > >Adding a subtest find in t/db_dependent/Koha/Objects.t. > >Test plan: >Run t/db_dependent/Koha/Objects.t > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/Koha/Objects.t | 29 ++++++++++++++++++++++++++++- > 1 file changed, 28 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Objects.t b/t/db_dependent/Koha/Objects.t >index 935dc47..c605798 100644 >--- a/t/db_dependent/Koha/Objects.t >+++ b/t/db_dependent/Koha/Objects.t >@@ -19,11 +19,12 @@ > > use Modern::Perl; > >-use Test::More tests => 13; >+use Test::More tests => 14; > use Test::Warn; > > use Koha::Authority::Types; > use Koha::Cities; >+use Koha::IssuingRules; > use Koha::Patron::Category; > use Koha::Patron::Categories; > use Koha::Patrons; >@@ -98,6 +99,32 @@ subtest 'new' => sub { > Koha::Patron::Categories->find($a_cat_code)->delete; > }; > >+subtest 'find' => sub { >+ plan tests => 4; >+ >+ # check find on a single PK >+ my $patron = $builder->build({ source => 'Borrower' }); >+ is( Koha::Patrons->find($patron->{borrowernumber})->surname, >+ $patron->{surname}, "Checking an arbitrary patron column after find" >+ ); >+ # check find with unique column >+ my $obj = Koha::Patrons->find($patron->{cardnumber}, { key => 'cardnumber' }); >+ is( $obj->borrowernumber, $patron->{borrowernumber}, >+ 'Find with unique column and key specified' ); >+ # check find with an additional where clause in the attrs hash >+ # we do not expect to find something now >+ is( Koha::Patrons->find( >+ $patron->{borrowernumber}, >+ { where => { surname => { '!=', $patron->{surname} }}}, >+ ), undef, 'Additional where clause in find call' ); >+ >+ # check find with a composite FK >+ my $rule = $builder->build({ source => 'Issuingrule' }); >+ my @pk = ( $rule->{branchcode}, $rule->{categorycode}, $rule->{itemtype} ); >+ is( ref(Koha::IssuingRules->find(@pk)), "Koha::IssuingRule", >+ 'Find returned a Koha object for composite primary key' ); >+}; >+ > subtest 'search_related' => sub { > plan tests => 8; > my $builder = t::lib::TestBuilder->new; >-- >2.7.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 18361
:
61754
|
62142
|
62143
|
62395
|
62396
|
62397
|
62909
|
62910
|
62911
|
64339
|
64340
|
64341
|
64347
|
64348
|
64349
|
64372
|
66006