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

(-)a/t/db_dependent/Circulation.t (+5 lines)
Lines 667-672 subtest "CanBookBeRenewed tests" => sub { Link Here
667
            categorycode => undef,
667
            categorycode => undef,
668
            branchcode   => undef,
668
            branchcode   => undef,
669
            itemtype     => undef,
669
            itemtype     => undef,
670
            checkout_type => undef,
670
            rule_name    => 'norenewalbefore',
671
            rule_name    => 'norenewalbefore',
671
            rule_value   => '7',
672
            rule_value   => '7',
672
        }
673
        }
Lines 2156-2161 subtest 'AddReturn + suspension_chargeperiod' => sub { Link Here
2156
            categorycode => undef,
2157
            categorycode => undef,
2157
            branchcode   => undef,
2158
            branchcode   => undef,
2158
            itemtype     => undef,
2159
            itemtype     => undef,
2160
            checkout_type => undef,
2159
            rule_name    => 'suspension_chargeperiod',
2161
            rule_name    => 'suspension_chargeperiod',
2160
            rule_value   => '2',
2162
            rule_value   => '2',
2161
        }
2163
        }
Lines 3488-3493 subtest 'Incremented fee tests' => sub { Link Here
3488
    my $library =
3490
    my $library =
3489
      $builder->build_object( { class => 'Koha::Libraries' } )->store;
3491
      $builder->build_object( { class => 'Koha::Libraries' } )->store;
3490
3492
3493
    my $checkout_type = $Koha::Checkouts::type->{checkout};
3494
3491
    my $module = new Test::MockModule('C4::Context');
3495
    my $module = new Test::MockModule('C4::Context');
3492
    $module->mock( 'userenv', sub { { branch => $library->id } } );
3496
    $module->mock( 'userenv', sub { { branch => $library->id } } );
3493
3497
Lines 3613-3618 subtest 'Incremented fee tests' => sub { Link Here
3613
            categorycode => $patron->categorycode,
3617
            categorycode => $patron->categorycode,
3614
            itemtype     => $itemtype->id,
3618
            itemtype     => $itemtype->id,
3615
            branchcode   => $library->id,
3619
            branchcode   => $library->id,
3620
            checkout_type => $checkout_type,
3616
            rule_name    => 'lengthunit',
3621
            rule_name    => 'lengthunit',
3617
            rule_value   => 'hours',
3622
            rule_value   => 'hours',
3618
        }
3623
        }
(-)a/t/db_dependent/Circulation/CalcFine.t (-1 / +4 lines)
Lines 83-88 subtest 'Test basic functionality' => sub { Link Here
83
            branchcode   => undef,
83
            branchcode   => undef,
84
            categorycode => undef,
84
            categorycode => undef,
85
            itemtype     => undef,
85
            itemtype     => undef,
86
            checkout_type => undef,
86
            rules        => {
87
            rules        => {
87
                fine                          => '1.00',
88
                fine                          => '1.00',
88
                lengthunit                    => 'days',
89
                lengthunit                    => 'days',
Lines 123-128 subtest 'Test cap_fine_to_replacement_price' => sub { Link Here
123
            branchcode   => undef,
124
            branchcode   => undef,
124
            categorycode => undef,
125
            categorycode => undef,
125
            itemtype     => undef,
126
            itemtype     => undef,
127
            checkout_type => undef,
126
            rules        => {
128
            rules        => {
127
                fine                          => '1.00',
129
                fine                          => '1.00',
128
                lengthunit                    => 'days',
130
                lengthunit                    => 'days',
Lines 170-175 subtest 'Test cap_fine_to_replacement_pricew with overduefinescap' => sub { Link Here
170
            branchcode   => undef,
172
            branchcode   => undef,
171
            categorycode => undef,
173
            categorycode => undef,
172
            itemtype     => undef,
174
            itemtype     => undef,
175
            checkout_type => undef,
173
            rules        => {
176
            rules        => {
174
                fine                          => '1.00',
177
                fine                          => '1.00',
175
                lengthunit                    => 'days',
178
                lengthunit                    => 'days',
Lines 197-203 subtest 'Test cap_fine_to_replacement_pricew with overduefinescap' => sub { Link Here
197
    my ($amount) = CalcFine( $item, $patron->{categorycode}, $branch->{branchcode}, $start_dt, $end_dt );
200
    my ($amount) = CalcFine( $item, $patron->{categorycode}, $branch->{branchcode}, $start_dt, $end_dt );
198
    is( int($amount), 3, 'Got the lesser of overduefinescap and replacement price where overduefinescap < replacement price' );
201
    is( int($amount), 3, 'Got the lesser of overduefinescap and replacement price where overduefinescap < replacement price' );
199
202
200
    Koha::CirculationRules->set_rule({ rule_name => 'overduefinescap', rule_value => 6, branchcode => undef, categorycode => undef, itemtype => undef });
203
    Koha::CirculationRules->set_rule({ rule_name => 'overduefinescap', rule_value => 6, branchcode => undef, categorycode => undef, itemtype => undef, checkout_type => undef });
201
    ($amount) = CalcFine( $item, $patron->{categorycode}, $branch->{branchcode}, $start_dt, $end_dt );
204
    ($amount) = CalcFine( $item, $patron->{categorycode}, $branch->{branchcode}, $start_dt, $end_dt );
202
    is( int($amount), 5, 'Get the lesser of overduefinescap and replacement price where overduefinescap > replacement price' );
205
    is( int($amount), 5, 'Get the lesser of overduefinescap and replacement price where overduefinescap > replacement price' );
203
206
(-)a/t/db_dependent/Circulation/ReturnClaims.t (+1 lines)
Lines 51-56 Koha::CirculationRules->set_rule( Link Here
51
        branchcode   => undef,
51
        branchcode   => undef,
52
        categorycode => undef,
52
        categorycode => undef,
53
        itemtype     => undef,
53
        itemtype     => undef,
54
        checkout_type => undef,
54
        rule_name    => 'issuelength',
55
        rule_name    => 'issuelength',
55
        rule_value   => 1
56
        rule_value   => 1
56
    }
57
    }
(-)a/t/db_dependent/Circulation/Returns.t (+1 lines)
Lines 63-68 Koha::CirculationRules->set_rule( Link Here
63
        categorycode => undef,
63
        categorycode => undef,
64
        itemtype     => undef,
64
        itemtype     => undef,
65
        branchcode   => undef,
65
        branchcode   => undef,
66
        checkout_type => undef,
66
        rule_name    => 'issuelength',
67
        rule_name    => 'issuelength',
67
        rule_value   => 1,
68
        rule_value   => 1,
68
    }
69
    }
(-)a/t/db_dependent/Koha/IssuingRules.t (-3 / +17 lines)
Lines 154-162 subtest 'set_rule' => sub { Link Here
154
    my $branchcode   = $builder->build({ source => 'Branch' })->{'branchcode'};
154
    my $branchcode   = $builder->build({ source => 'Branch' })->{'branchcode'};
155
    my $categorycode = $builder->build({ source => 'Category' })->{'categorycode'};
155
    my $categorycode = $builder->build({ source => 'Category' })->{'categorycode'};
156
    my $itemtype     = $builder->build({ source => 'Itemtype' })->{'itemtype'};
156
    my $itemtype     = $builder->build({ source => 'Itemtype' })->{'itemtype'};
157
    my $checkout_type = $Koha::Checkouts::type->{checkout};
157
158
158
    subtest 'Correct call' => sub {
159
    subtest 'Correct call' => sub {
159
        plan tests => 4;
160
        plan tests => 5;
160
161
161
        Koha::CirculationRules->delete;
162
        Koha::CirculationRules->delete;
162
163
Lines 172-177 subtest 'set_rule' => sub { Link Here
172
            Koha::CirculationRules->set_rule( {
173
            Koha::CirculationRules->set_rule( {
173
                branchcode => $branchcode,
174
                branchcode => $branchcode,
174
                categorycode => $categorycode,
175
                categorycode => $categorycode,
176
                checkout_type => $checkout_type,
175
                rule_name => 'patron_maxissueqty',
177
                rule_name => 'patron_maxissueqty',
176
                rule_value => '',
178
                rule_value => '',
177
            } );
179
            } );
Lines 191-200 subtest 'set_rule' => sub { Link Here
191
                branchcode => $branchcode,
193
                branchcode => $branchcode,
192
                categorycode => $categorycode,
194
                categorycode => $categorycode,
193
                itemtype => $itemtype,
195
                itemtype => $itemtype,
196
                checkout_type => $checkout_type,
194
                rule_name => 'fine',
197
                rule_name => 'fine',
195
                rule_value => '',
198
                rule_value => '',
196
            } );
199
            } );
197
        }, 'setting fine with branch/category/itemtype succeeds' );
200
        }, 'setting fine with branch/category/itemtype/checkout_type succeeds' );
201
202
        lives_ok( sub {
203
            Koha::CirculationRules->set_rule( {
204
                branchcode => $branchcode,
205
                categorycode => $categorycode,
206
                itemtype => $itemtype,
207
                checkout_type => $checkout_type,
208
                rule_name => 'maxissueqty',
209
                rule_value => 5,
210
            } );
211
        }, 'setting maxissueqty with branch/category/itemtype/checkout_type succeeds' );
198
    };
212
    };
199
213
200
    subtest 'Call with missing params' => sub {
214
    subtest 'Call with missing params' => sub {
Lines 212-217 subtest 'set_rule' => sub { Link Here
212
        throws_ok( sub {
226
        throws_ok( sub {
213
            Koha::CirculationRules->set_rule( {
227
            Koha::CirculationRules->set_rule( {
214
                branchcode => $branchcode,
228
                branchcode => $branchcode,
229
                checkout_type => $checkout_type,
215
                rule_name => 'patron_maxissueqty',
230
                rule_name => 'patron_maxissueqty',
216
                rule_value => '',
231
                rule_value => '',
217
            } );
232
            } );
218
- 

Return to bug 25089