|
Lines 19-27
Link Here
|
| 19 |
|
19 |
|
| 20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
| 21 |
|
21 |
|
| 22 |
use Test::More tests => 6; |
22 |
use Test::More tests => 7; |
| 23 |
use Test::Warn; |
23 |
use Test::Warn; |
| 24 |
|
24 |
|
|
|
25 |
use C4::Circulation; |
| 25 |
use Koha::Patron; |
26 |
use Koha::Patron; |
| 26 |
use Koha::Patrons; |
27 |
use Koha::Patrons; |
| 27 |
use Koha::Database; |
28 |
use Koha::Database; |
|
Lines 55-60
my $new_patron_2 = Koha::Patron->new(
Link Here
|
| 55 |
} |
56 |
} |
| 56 |
)->store; |
57 |
)->store; |
| 57 |
|
58 |
|
|
|
59 |
C4::Context->_new_userenv('xxx'); |
| 60 |
C4::Context->set_userenv(0,0,0,'firstname','surname', $library->{branchcode}, 'Midway Public Library', '', '', ''); |
| 61 |
|
| 58 |
is( Koha::Patrons->search->count, $nb_of_patrons + 2, 'The 2 patrons should have been added' ); |
62 |
is( Koha::Patrons->search->count, $nb_of_patrons + 2, 'The 2 patrons should have been added' ); |
| 59 |
|
63 |
|
| 60 |
my $retrieved_patron_1 = Koha::Patrons->find( $new_patron_1->borrowernumber ); |
64 |
my $retrieved_patron_1 = Koha::Patrons->find( $new_patron_1->borrowernumber ); |
|
Lines 102-107
subtest 'siblings' => sub {
Link Here
|
| 102 |
$retrieved_guarantee_1->delete; |
106 |
$retrieved_guarantee_1->delete; |
| 103 |
}; |
107 |
}; |
| 104 |
|
108 |
|
|
|
109 |
subtest 'has_overdues' => sub { |
| 110 |
plan tests => 3; |
| 111 |
|
| 112 |
my $biblioitem_1 = $builder->build( { source => 'Biblioitem' } ); |
| 113 |
my $item_1 = $builder->build( |
| 114 |
{ source => 'Item', |
| 115 |
value => { |
| 116 |
homebranch => $library->{branchcode}, |
| 117 |
holdingbranch => $library->{branchcode}, |
| 118 |
notforloan => 0, |
| 119 |
itemlost => 0, |
| 120 |
withdrawn => 0, |
| 121 |
biblionumber => $biblioitem_1->{biblionumber} |
| 122 |
} |
| 123 |
} |
| 124 |
); |
| 125 |
my $retrieved_patron = Koha::Patrons->find( $new_patron_1->borrowernumber ); |
| 126 |
is( $retrieved_patron->has_overdues, 0, ); |
| 127 |
|
| 128 |
my $tomorrow = DateTime->today( time_zone => C4::Context->tz() )->add( days => 1 ); |
| 129 |
my $issue = AddIssue( $new_patron_1->unblessed, $item_1->{barcode} ); |
| 130 |
is( $retrieved_patron->has_overdues, 0, ); |
| 131 |
AddReturn( $item_1->{barcode} ); |
| 132 |
my $yesterday = DateTime->today(time_zone => C4::Context->tz())->add( days => -1 ); |
| 133 |
$issue = AddIssue( $new_patron_1->unblessed, $item_1->{barcode}, $yesterday ); |
| 134 |
$retrieved_patron = Koha::Patrons->find( $new_patron_1->borrowernumber ); |
| 135 |
is( $retrieved_patron->has_overdues, 1, ); |
| 136 |
AddReturn( $item_1->{barcode} ); |
| 137 |
}; |
| 138 |
|
| 105 |
subtest 'update_password' => sub { |
139 |
subtest 'update_password' => sub { |
| 106 |
plan tests => 7; |
140 |
plan tests => 7; |
| 107 |
|
141 |
|
| 108 |
- |
|
|