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

(-)a/t/db_dependent/SIP/ILS.t (-2 / +52 lines)
Lines 20-33 Link Here
20
20
21
use Modern::Perl;
21
use Modern::Perl;
22
22
23
use Test::More tests => 10;
23
use Test::More tests => 11;
24
24
25
use t::lib::TestBuilder;
25
use t::lib::TestBuilder;
26
use t::lib::Mocks;
26
use t::lib::Mocks;
27
27
28
use C4::Reserves;
28
use C4::Reserves;
29
use C4::Circulation;
29
use Koha::CirculationRules;
30
use Koha::CirculationRules;
30
use Koha::Database;
31
use Koha::Database;
32
use Koha::DateUtils;
31
33
32
BEGIN {
34
BEGIN {
33
    use_ok('C4::SIP::ILS');
35
    use_ok('C4::SIP::ILS');
Lines 122-125 subtest cancel_hold => sub { Link Here
122
    is( $item->biblio->holds->count(), 0, "Bib has 0 holds remaining");
124
    is( $item->biblio->holds->count(), 0, "Bib has 0 holds remaining");
123
    is( $item->holds->count(), 0,  "Item has 0 holds remaining");
125
    is( $item->holds->count(), 0,  "Item has 0 holds remaining");
124
};
126
};
127
128
subtest checkout => sub {
129
    plan tests => 1;
130
131
    my $library = $builder->build_object ({ class => 'Koha::Libraries' });
132
    my $patron = $builder->build_object(
133
        {
134
            class => 'Koha::Patrons',
135
            value => {
136
                branchcode => $library->branchcode,
137
            }
138
        }
139
    );
140
    t::lib::Mocks::mock_userenv({ branchcode => $library->branchcode, flags => 1 });
141
142
    my $item = $builder->build_sample_item({
143
        library       => $library->branchcode,
144
    });
145
146
    Koha::CirculationRules->set_rules(
147
        {
148
            categorycode => $patron->categorycode,
149
            branchcode   => $library->branchcode,
150
            itemtype     => $item->effective_itemtype,
151
            rules        => {
152
                onshelfholds     => 1,
153
                reservesallowed  => 3,
154
                holds_per_record => 3,
155
                issuelength      => 5,
156
                lengthunit       => 'days',
157
                renewalsallowed  => 6,
158
            }
159
        }
160
    );
161
162
    AddIssue( $patron->unblessed, $item->barcode, undef, 0 );
163
    my $checkout = $item->checkout;
164
    ok( defined($checkout), "Checkout added");
165
    is( $checkout->renewals, 0, "Correct renewals");
166
    
167
    my $ils = C4::SIP::ILS->new({ id => $library->branchcode });
168
    my $sip_patron = C4::SIP::ILS::Patron->new( $patron->cardnumber );
169
    my $transaction = $ils->checkout($patron->cardnumber,$item->barcode,undef,undef);
170
171
    is( $transaction->{screen_msg},"Item already checked out to you: renewing item.","We get a success message when issue is renewed");
172
173
    is( $checkout->renewals, 1, "Renewals has been reduced");
174
};
175
125
$schema->storage->txn_rollback;
176
$schema->storage->txn_rollback;
126
- 

Return to bug 25808