View | Details | Raw Unified | Return to bug 17229
Collapse All | Expand All

(-)a/t/db_dependent/Holds.t (-21 / +2 lines)
Lines 7-13 use t::lib::TestBuilder; Link Here
7
7
8
use C4::Context;
8
use C4::Context;
9
9
10
use Test::More tests => 62;
10
use Test::More tests => 61;
11
use MARC::Record;
11
use MARC::Record;
12
12
13
use C4::Biblio;
13
use C4::Biblio;
Lines 42-53 my $dbh = C4::Context->dbh; Link Here
42
my $branch_1 = $builder->build({ source => 'Branch' })->{ branchcode };
42
my $branch_1 = $builder->build({ source => 'Branch' })->{ branchcode };
43
my $branch_2 = $builder->build({ source => 'Branch' })->{ branchcode };
43
my $branch_2 = $builder->build({ source => 'Branch' })->{ branchcode };
44
44
45
my $category = $builder->build({
45
my $category = $builder->build({ source => 'Category' });
46
    source => 'Category',
47
    value => {
48
        BlockExpiredPatronOpacActions => -1,
49
    },
50
});
51
46
52
my $borrowers_count = 5;
47
my $borrowers_count = 5;
53
48
Lines 136-155 my $patron = Koha::Patrons->find( $borrowernumbers[0] ); Link Here
136
$holds = $patron->holds;
131
$holds = $patron->holds;
137
is( $holds->next->borrowernumber, $borrowernumbers[0], "Test Koha::Patron->holds");
132
is( $holds->next->borrowernumber, $borrowernumbers[0], "Test Koha::Patron->holds");
138
133
139
my $expired_borrowernumber = Koha::Patron->new({
140
        firstname =>  'Expired',
141
        surname => 'Patron',
142
        categorycode => $category->{categorycode},
143
        branchcode => $branch_1,
144
	dateexpiry => '2000-01-01',
145
    })->store->borrowernumber;
146
147
t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', 1);
148
ok(
149
    CanItemBeReserved($expired_borrowernumber, $itemnumber)->{status} eq 'patronExpired',
150
    'Expired patron cannot reserve'
151
);
152
153
$holds = $item->current_holds;
134
$holds = $item->current_holds;
154
$first_hold = $holds->next;
135
$first_hold = $holds->next;
155
$borrowernumber = $first_hold->borrowernumber;
136
$borrowernumber = $first_hold->borrowernumber;
(-)a/t/db_dependent/ILSDI_Services.t (-2 / +35 lines)
Lines 302-308 subtest 'LookupPatron test' => sub { Link Here
302
302
303
subtest 'Holds test' => sub {
303
subtest 'Holds test' => sub {
304
304
305
    plan tests => 5;
305
    plan tests => 6;
306
306
307
    $schema->storage->txn_begin;
307
    $schema->storage->txn_begin;
308
308
Lines 448-453 subtest 'Holds test' => sub { Link Here
448
    $reply = C4::ILSDI::Services::HoldItem( $query );
448
    $reply = C4::ILSDI::Services::HoldItem( $query );
449
    is( $reply->{code}, 'damaged', "Item is damaged" );
449
    is( $reply->{code}, 'damaged', "Item is damaged" );
450
450
451
    # Test Patron cannot reserve if expired and BlockExpiredPatronOpacActions
452
    my $category = $builder->build({
453
        source => 'Category',
454
        value => { BlockExpiredPatronOpacActions => -1 }
455
        });
456
457
    my $branch_1 = $builder->build({ source => 'Branch' })->{ branchcode };
458
459
    my $expired_borrowernumber = Koha::Patron->new({
460
        firstname =>  'Expired',
461
        surname => 'Patron',
462
        categorycode => $category->{categorycode},
463
        branchcode => $branch_1,
464
        dateexpiry => '2000-01-01',
465
    })->store->borrowernumber;
466
467
    t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', 1);
468
469
    my $item5 = $builder->build({
470
        source => 'Item',
471
        value => {
472
            biblionumber => $biblio->{biblionumber},
473
            damaged => 0,
474
        }
475
    });
476
477
    $query = new CGI;
478
    $query->param( 'patron_id', $expired_borrowernumber);
479
    $query->param( 'bib_id', $biblio->{biblionumber});
480
    $query->param( 'item_id', $item5->{itemnumber});
481
482
    $reply = C4::ILSDI::Services::HoldItem( $query );
483
    is( $reply->{code}, 'PatronExpired', "Patron is expired" );
484
451
    $schema->storage->txn_rollback;
485
    $schema->storage->txn_rollback;
452
};
486
};
453
487
454
- 

Return to bug 17229