Lines 19-25
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Test::More tests => 8; |
22 |
use Test::More tests => 9; |
23 |
use Test::Exception; |
23 |
use Test::Exception; |
24 |
|
24 |
|
25 |
use C4::Circulation qw/AddIssue AddReturn/; |
25 |
use C4::Circulation qw/AddIssue AddReturn/; |
Lines 34-39
use t::lib::TestBuilder;
Link Here
|
34 |
my $schema = Koha::Database->new->schema; |
34 |
my $schema = Koha::Database->new->schema; |
35 |
my $builder = t::lib::TestBuilder->new; |
35 |
my $builder = t::lib::TestBuilder->new; |
36 |
|
36 |
|
|
|
37 |
subtest 'patron() tests' => sub { |
38 |
|
39 |
plan tests => 3; |
40 |
|
41 |
$schema->storage->txn_begin; |
42 |
|
43 |
my $library = $builder->build( { source => 'Branch' } ); |
44 |
my $patron = $builder->build( { source => 'Borrower' } ); |
45 |
|
46 |
my $line = Koha::Account::Line->new( |
47 |
{ |
48 |
borrowernumber => $patron->{borrowernumber}, |
49 |
accounttype => "OVERDUE", |
50 |
status => "RETURNED", |
51 |
amount => 10, |
52 |
interface => 'commandline', |
53 |
})->store; |
54 |
|
55 |
my $account_line_patron = $line->patron; |
56 |
is( ref( $account_line_patron ), 'Koha::Patron', 'Koha::Account::Line->patron should return a Koha::Patron' ); |
57 |
is( $line->borrowernumber, $account_line_patron->borrowernumber, 'Koha::Account::Line->patron should return the correct borrower' ); |
58 |
|
59 |
$line->borrowernumber(undef)->store; |
60 |
is( $line->patron, undef, 'Koha::Account::Line->patron should return undef if no patron linked' ); |
61 |
|
62 |
$schema->storage->txn_rollback; |
63 |
}; |
64 |
|
65 |
|
37 |
subtest 'item() tests' => sub { |
66 |
subtest 'item() tests' => sub { |
38 |
|
67 |
|
39 |
plan tests => 3; |
68 |
plan tests => 3; |
40 |
- |
|
|