Bugzilla – Attachment 72331 Details for
Bug 19532
Recalls for Koha
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19532: Tests for Koha/Recalls
Bug-19532-Tests-for-KohaRecalls.patch (text/plain), 3.77 KB, created by
Nick Clemens
on 2018-03-01 16:01:42 UTC
(
hide
)
Description:
Bug 19532: Tests for Koha/Recalls
Filename:
MIME Type:
Creator:
Nick Clemens
Created:
2018-03-01 16:01:42 UTC
Size:
3.77 KB
patch
obsolete
>From ac68d8b33ae5b7c625cb72fe93833d1fc08b7ac0 Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Tue, 28 Nov 2017 03:45:21 +0000 >Subject: [PATCH] Bug 19532: Tests for Koha/Recalls > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > t/db_dependent/Koha/Recalls.t | 78 +++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 78 insertions(+) > create mode 100644 t/db_dependent/Koha/Recalls.t > >diff --git a/t/db_dependent/Koha/Recalls.t b/t/db_dependent/Koha/Recalls.t >new file mode 100644 >index 0000000..4e96e43 >--- /dev/null >+++ b/t/db_dependent/Koha/Recalls.t >@@ -0,0 +1,78 @@ >+#!/usr/bin/perl >+ >+# Copyright 2017 Aleisha Amohia <aleisha@catalyst.net.nz> >+# >+# 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, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+ >+use Test::More tests => 11; >+ >+use Koha::Recalls; >+use Koha::Recall; >+use Koha::Database; >+use Koha::DateUtils; >+use C4::Circulation; >+use t::lib::TestBuilder; >+ >+my $schema = Koha::Database->new->schema; >+$schema->storage->txn_begin; >+ >+my $builder = t::lib::TestBuilder->new; >+my $library = $builder->build( { source => 'Branch' } ); >+my $patron = $builder->build( { source => 'Borrower', value => { branchcode => $library->{branchcode} } } ); >+my $biblio = $builder->build( { source => 'Biblio' } ); >+my $itemtype = $builder->build( { source => 'Itemtype' } ); >+my $item = $builder->build( { source => 'Item', value => { biblionumber => $biblio->{biblionumber}, itype => $itemtype->{itemtype}, holdingbranch => $library->{branchcode} } } ); >+my $checkout = $builder->build( { source => 'Issue', value => { borrowernumber => 5, itemnumber => $item->{itemnumber} } } ); >+ >+# recall requested by second patron >+my $recall = Koha::Recall->new({ >+ borrowernumber => $patron->{borrowernumber}, >+ recalldate => dt_from_string(), >+ branchcode => $item->{holdingbranch}, >+ status => 'R', >+ biblionumber => $biblio->{biblionumber}, >+ itemnumber => $item->{itemnumber}, >+ itemtype => $item->{itype}, >+})->store; >+ >+is( Koha::Recalls->search->count, 1, 'The one recall should be added' ); >+is( $recall->is_requested, 1, 'Recall status is set to R, requested' ); >+ >+$recall->update({ status => 'O' }); >+is( $recall->is_overdue, 1, 'Recall is overdue to be returned' ); >+ >+$recall->update({ status => 'W', waitingdate => dt_from_string() }); >+is( $recall->is_waiting, 1, 'Recall is waiting for pickup' ); >+ >+$recall->update({ status => 'C', cancellationdate => dt_from_string(), old => 1 }); >+is( $recall->is_cancelled, 1, 'Recall has been cancelled' ); >+ >+$recall->update({ status => 'E', expirationdate => dt_from_string() }); >+is( $recall->has_expired, 1, 'Recall has expired' ); >+ >+is( $biblio->{biblionumber}, $recall->biblio->biblionumber, 'Can access biblio from recall' ); >+ >+is( $patron->{borrowernumber}, $recall->borrower->borrowernumber, 'Can access borrower from recall' ); >+ >+is( $item->{itemnumber}, $recall->item->itemnumber, 'Can access item from recall' ); >+ >+is( $library->{branchcode}, $recall->branch->branchcode, 'Can access branch from recall' ); >+ >+is( $checkout->{issue_id}, $recall->checkout->issue_id, 'Can access checkout from recall' ); >+ >+$schema->storage->txn_rollback; >-- >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 19532
:
68569
|
68570
|
68571
|
68572
|
68642
|
68643
|
68644
|
68645
|
68653
|
69100
|
69102
|
69147
|
69148
|
69149
|
69170
|
69172
|
69221
|
69222
|
69223
|
69322
|
69353
|
69354
|
69405
|
69409
|
69410
|
69411
|
69841
|
69872
|
69873
|
69874
|
69875
|
69876
|
69877
|
69878
|
69879
|
69880
|
69881
|
69882
|
69883
|
69884
|
69885
|
69886
|
69887
|
69888
|
69889
|
69890
|
69986
|
70093
|
71409
|
71574
|
71575
|
71576
|
71577
|
71578
|
71579
|
71580
|
71581
|
71582
|
71583
|
71584
|
71585
|
71586
|
71587
|
71588
|
71589
|
71590
|
71591
|
71592
|
72244
|
72311
|
72312
|
72313
|
72314
|
72315
|
72316
|
72317
|
72318
|
72319
|
72320
|
72321
|
72322
|
72323
|
72324
|
72325
|
72326
|
72327
|
72328
|
72329
|
72330
| 72331 |
72332
|
72333
|
72334
|
72335
|
72336
|
72337
|
72338
|
72527