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

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

Return to bug 17229