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 41-52 my $dbh = C4::Context->dbh; Link Here
41
my $branch_1 = $builder->build({ source => 'Branch' })->{ branchcode };
41
my $branch_1 = $builder->build({ source => 'Branch' })->{ branchcode };
42
my $branch_2 = $builder->build({ source => 'Branch' })->{ branchcode };
42
my $branch_2 = $builder->build({ source => 'Branch' })->{ branchcode };
43
43
44
my $category = $builder->build({
44
my $category = $builder->build({ source => 'Category' });
45
    source => 'Category',
46
    value => {
47
        BlockExpiredPatronOpacActions => -1,
48
    },
49
});
50
45
51
my $borrowers_count = 5;
46
my $borrowers_count = 5;
52
47
Lines 131-150 my $patron = Koha::Patrons->find( $borrowernumbers[0] ); Link Here
131
$holds = $patron->holds;
126
$holds = $patron->holds;
132
is( $holds->next->borrowernumber, $borrowernumbers[0], "Test Koha::Patron->holds");
127
is( $holds->next->borrowernumber, $borrowernumbers[0], "Test Koha::Patron->holds");
133
128
134
my $expired_borrowernumber = Koha::Patron->new({
135
        firstname =>  'Expired',
136
        surname => 'Patron',
137
        categorycode => $category->{categorycode},
138
        branchcode => $branch_1,
139
	dateexpiry => '2000-01-01',
140
    })->store->borrowernumber;
141
142
t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', 1);
143
ok(
144
    CanItemBeReserved($expired_borrowernumber, $itemnumber)->{status} eq 'patronExpired',
145
    'Expired patron cannot reserve'
146
);
147
148
$holds = $item->current_holds;
129
$holds = $item->current_holds;
149
$first_hold = $holds->next;
130
$first_hold = $holds->next;
150
$borrowernumber = $first_hold->borrowernumber;
131
$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 451-456 subtest 'Holds test' => sub { Link Here
451
    $reply = C4::ILSDI::Services::HoldItem( $query );
451
    $reply = C4::ILSDI::Services::HoldItem( $query );
452
    is( $reply->{code}, 'damaged', "Item is damaged" );
452
    is( $reply->{code}, 'damaged', "Item is damaged" );
453
453
454
    # Test Patron cannot reserve if expired and BlockExpiredPatronOpacActions
455
    my $category = $builder->build({
456
        source => 'Category',
457
        value => { BlockExpiredPatronOpacActions => -1 }
458
        });
459
460
    my $branch_1 = $builder->build({ source => 'Branch' })->{ branchcode };
461
462
    my $expired_borrowernumber = Koha::Patron->new({
463
        firstname =>  'Expired',
464
        surname => 'Patron',
465
        categorycode => $category->{categorycode},
466
        branchcode => $branch_1,
467
        dateexpiry => '2000-01-01',
468
    })->store->borrowernumber;
469
470
    t::lib::Mocks::mock_preference('BlockExpiredPatronOpacActions', 1);
471
472
    my $item5 = $builder->build({
473
        source => 'Item',
474
        value => {
475
            biblionumber => $biblio->{biblionumber},
476
            damaged => 0,
477
        }
478
    });
479
480
    $query = new CGI;
481
    $query->param( 'patron_id', $expired_borrowernumber);
482
    $query->param( 'bib_id', $biblio->{biblionumber});
483
    $query->param( 'item_id', $item5->{itemnumber});
484
485
    $reply = C4::ILSDI::Services::HoldItem( $query );
486
    is( $reply->{code}, 'PatronExpired', "Patron is expired" );
487
454
    $schema->storage->txn_rollback;
488
    $schema->storage->txn_rollback;
455
};
489
};
456
490
457
- 

Return to bug 17229