Bugzilla – Attachment 100895 Details for
Bug 23531
ILS-DI doesn't implement needed_before_date and pickup_expiry_date parameters (renamed start_date and expiry_date)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23531: Simplify tests using build_object
Bug-23531-Simplify-tests-using-buildobject.patch (text/plain), 4.08 KB, created by
Jonathan Druart
on 2020-03-17 14:17:42 UTC
(
hide
)
Description:
Bug 23531: Simplify tests using build_object
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-03-17 14:17:42 UTC
Size:
4.08 KB
patch
obsolete
>From 9aabdf23d82ddb45ce53f1603141426de156bc5a Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 17 Mar 2020 15:03:53 +0100 >Subject: [PATCH] Bug 23531: Simplify tests using build_object > >And build_sample_item. >Also remove a debug statement >--- > t/db_dependent/ILSDI_Services.t | 51 ++++++++++----------------------- > 1 file changed, 15 insertions(+), 36 deletions(-) > >diff --git a/t/db_dependent/ILSDI_Services.t b/t/db_dependent/ILSDI_Services.t >index 6f4f1aa1ee..0e1466f648 100644 >--- a/t/db_dependent/ILSDI_Services.t >+++ b/t/db_dependent/ILSDI_Services.t >@@ -553,39 +553,20 @@ subtest 'Holds test with start_date and end_date' => sub { > > $schema->storage->txn_begin; > >- my $pickup_branch = $builder->build( >+ my $pickup_library = $builder->build_object( > { >- source => 'Branch', >+ class => 'Koha::Libraries', > value => { > pickup_location => 1, > } > } > ); > >- my $patron = $builder->build({ >- source => 'Borrower', >- }); >- >- my $biblio = $builder->build({ >- source => 'Biblio', >- }); >- >- my $biblioitems = $builder->build({ >- source => 'Biblioitem', >- value => { >- biblionumber => $biblio->{biblionumber}, >- } >+ my $patron = $builder->build_object({ >+ class => 'Koha::Patrons', > }); > >- my $item = $builder->build({ >- source => 'Item', >- value => { >- homebranch => $pickup_branch->{branchcode}, >- holdingbranch => $pickup_branch->{branchcode}, >- biblionumber => $biblio->{biblionumber}, >- damaged => 0, >- } >- }); >+ my $item = $builder->build_sample_item({ library => $pickup_library->branchcode }); > > Koha::CirculationRules->set_rule( > { >@@ -598,28 +579,26 @@ subtest 'Holds test with start_date and end_date' => sub { > ); > > my $query = new CGI; >- $query->param( 'pickup_location', $pickup_branch->{branchcode} ); >- $query->param( 'patron_id', $patron->{borrowernumber}); >- $query->param( 'bib_id', $biblio->{biblionumber}); >- $query->param( 'item_id', $item->{itemnumber}); >+ $query->param( 'pickup_location', $pickup_library->branchcode ); >+ $query->param( 'patron_id', $patron->borrowernumber); >+ $query->param( 'bib_id', $item->biblionumber); >+ $query->param( 'item_id', $item->itemnumber); > $query->param( 'start_date', '2020-03-20'); > $query->param( 'expiry_date', '2020-04-22'); > > my $reply = C4::ILSDI::Services::HoldItem( $query ); >- is ($reply->{pickup_location}, $pickup_branch->{branchname}, "Item hold with date parameters was placed"); >- my $hold = Koha::Holds->search({ biblionumber => $biblio->{biblionumber}})->next(); >- use Data::Dumper; >- print Dumper($hold); >- is( $hold->biblionumber, $biblio->{biblionumber}, "correct biblionumber"); >+ is ($reply->{pickup_location}, $pickup_library->branchname, "Item hold with date parameters was placed"); >+ my $hold = Koha::Holds->search({ biblionumber => $item->biblionumber})->next(); >+ is( $hold->biblionumber, $item->biblionumber, "correct biblionumber"); > is( $hold->reservedate, '2020-03-20', "Item hold has correct start date" ); > is( $hold->expirationdate, '2020-04-22', "Item hold has correct end date" ); > > $hold->delete(); > > $reply = C4::ILSDI::Services::HoldTitle( $query ); >- is ($reply->{pickup_location}, $pickup_branch->{branchname}, "Record hold with date parameters was placed"); >- $hold = Koha::Holds->search({ biblionumber => $biblio->{biblionumber}})->next(); >- is( $hold->biblionumber, $biblio->{biblionumber}, "correct biblionumber"); >+ is ($reply->{pickup_location}, $pickup_library->branchname, "Record hold with date parameters was placed"); >+ $hold = Koha::Holds->search({ biblionumber => $item->biblionumber})->next(); >+ is( $hold->biblionumber, $item->biblionumber, "correct biblionumber"); > is( $hold->reservedate, '2020-03-20', "Record hold has correct start date" ); > is( $hold->expirationdate, '2020-04-22', "Record hold has correct end date" ); > >-- >2.20.1
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 23531
:
92538
|
93475
|
96563
|
96564
|
100165
|
100166
|
100221
|
100222
|
100294
|
100295
|
100895
|
100896
|
100897
|
100898