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

(-)a/t/db_dependent/Reserves.t (-2 / +37 lines)
Lines 61-67 my $frameworkcode = q//; Link Here
61
t::lib::Mocks::mock_preference('ReservesNeedReturns', 1);
61
t::lib::Mocks::mock_preference('ReservesNeedReturns', 1);
62
62
63
# Somewhat arbitrary field chosen for age restriction unit tests. Must be added to db before the framework is cached
63
# Somewhat arbitrary field chosen for age restriction unit tests. Must be added to db before the framework is cached
64
$dbh->do("update marc_subfield_structure set kohafield='biblioitems.agerestriction' where tagfield='521' and tagsubfield='a' and frameworkcode=?", undef, $frameworkcode);
64
$dbh->do(q|
65
    INSERT INTO marc_subfield_structure (frameworkcode, tagfield, tagsubfield, kohafield)
66
    VALUES ('', '521', 'a', 'biblioitems.agerestriction')
67
    ON DUPLICATE KEY UPDATE kohafield = VALUES(kohafield)
68
|);
65
my $cache = Koha::Caches->get_instance;
69
my $cache = Koha::Caches->get_instance;
66
$cache->clear_from_cache("MarcStructure-0-$frameworkcode");
70
$cache->clear_from_cache("MarcStructure-0-$frameworkcode");
67
$cache->clear_from_cache("MarcStructure-1-$frameworkcode");
71
$cache->clear_from_cache("MarcStructure-1-$frameworkcode");
Lines 1152-1157 subtest 'CheckReserves additional test' => sub { Link Here
1152
    is( scalar @$possible_reserves, 2, 'We do get both reserves' );
1156
    is( scalar @$possible_reserves, 2, 'We do get both reserves' );
1153
};
1157
};
1154
1158
1159
<<<<<<< HEAD
1155
subtest 'AllowHoldOnPatronPossession test' => sub {
1160
subtest 'AllowHoldOnPatronPossession test' => sub {
1156
1161
1157
    plan tests => 4;
1162
    plan tests => 4;
Lines 1188-1193 subtest 'AllowHoldOnPatronPossession test' => sub { Link Here
1188
                                       $item->itemnumber)->{status},
1193
                                       $item->itemnumber)->{status},
1189
       'OK',
1194
       'OK',
1190
       'Patron can place hold on an item loaned to itself');
1195
       'Patron can place hold on an item loaned to itself');
1196
=======
1197
subtest 'check maxreserve test' => sub {
1198
1199
    plan tests => 2;
1200
1201
    t::lib::Mocks::mock_preference('maxreserves', 1);
1202
    # Create the items and patrons we need
1203
    my $biblio_1 = $builder->build_sample_biblio();
1204
    my $biblio_2 = $builder->build_sample_biblio();
1205
    my $itype = $builder->build_object({ class => "Koha::ItemTypes", value => { notforloan => 0 } });
1206
    my $item_1 = $builder->build_sample_item({ biblionumber => $biblio_1->biblionumber,notforloan => 0, itype => $itype->itemtype });
1207
    my $item_2 = $builder->build_sample_item({ biblionumber => $biblio_2->biblionumber, notforloan => 0, itype => $itype->itemtype });
1208
    my $patron = $builder->build_object({ class => "Koha::Patrons" });
1209
1210
1211
    # Place a hold on the title for both patrons
1212
    my $reserve = AddReserve(
1213
        {
1214
            branchcode     => $item_1->homebranch,
1215
            borrowernumber => $patron->borrowernumber,
1216
            biblionumber   => $biblio_1->biblionumber,
1217
            priority       => 1,
1218
            itemnumber     => $item_1->itemnumber,
1219
        }
1220
    );
1221
1222
    my $borrowernumber = $patron->borrowernumber;
1223
1224
    is( C4::Reserves::CanBookBeReserved($borrowernumber, $biblio_2->biblionumber)->{status} , 'tooManyReserves', "Reserving more than maxreserves is forbidden");
1225
    is( C4::Reserves::CanItemBeReserved($borrowernumber, $item_2->itemnumber, $item_2->homebranch)->{status} , 'tooManyReserves', "Reserving more than maxreserves is forbidden");
1226
>>>>>>> Bug 11999: Test improvements + check maxreserves
1191
};
1227
};
1192
1228
1193
sub count_hold_print_messages {
1229
sub count_hold_print_messages {
1194
- 

Return to bug 11999