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

(-)a/t/db_dependent/Koha/Checkout.t (-2 / +56 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 2;
22
use Test::More tests => 3;
23
use t::lib::TestBuilder;
23
use t::lib::TestBuilder;
24
24
25
use Koha::Database;
25
use Koha::Database;
Lines 27-32 use Koha::Database; Link Here
27
my $builder = t::lib::TestBuilder->new;
27
my $builder = t::lib::TestBuilder->new;
28
my $schema  = Koha::Database->new->schema;
28
my $schema  = Koha::Database->new->schema;
29
29
30
subtest 'overdue_fines' => sub {
31
    plan tests => 4;
32
33
    my $checkout = $builder->build_object(
34
        {
35
            class => 'Koha::Checkouts',
36
        }
37
    );
38
39
    my $overdueline = Koha::Account::Line->new(
40
        {
41
            issue_id          => $checkout->id,
42
            borrowernumber    => $checkout->borrowernumber,
43
            itemnumber        => $checkout->itemnumber,
44
            branchcode        => $checkout->branchcode,
45
            date              => \'NOW()',
46
            debit_type_code   => 'OVERDUE',
47
            status            => 'UNRETURNED',
48
            interface         => 'cli',
49
            amount            => '1',
50
            amountoutstanding => '1',
51
        }
52
    )->store();
53
54
    my $accountline = Koha::Account::Line->new(
55
        {
56
            issue_id          => $checkout->id,
57
            borrowernumber    => $checkout->borrowernumber,
58
            itemnumber        => $checkout->itemnumber,
59
            branchcode        => $checkout->branchcode,
60
            date              => \'NOW()',
61
            debit_type_code   => 'LOST',
62
            status            => '',
63
            interface         => 'cli',
64
            amount            => '1',
65
            amountoutstanding => '1',
66
        }
67
    )->store();
68
69
    my $overdue_fines = $checkout->overdue_fines;
70
    is( ref($overdue_fines), 'Koha::Account::Lines',
71
        'Koha::Checkout->overdue_fines should return a Koha::Account::Lines' );
72
    is( $overdue_fines->count, 1, "Koha::Checkout->overdue_fines returns only overdue fines");
73
74
    my $overdue = $overdue_fines->next;
75
    is( ref($overdue), 'Koha::Account::Line',
76
        'next returns a Koha::Account::Line' );
77
78
    is(
79
        $overdueline->id,
80
        $overdue->id,
81
        'Koha::Checkout->overdue_fines should return the correct overdue_fines'
82
    );
83
};
84
30
subtest 'library() tests' => sub {
85
subtest 'library() tests' => sub {
31
86
32
    plan tests => 2;
87
    plan tests => 2;
33
- 

Return to bug 17976