|
Lines 17-23
Link Here
|
| 17 |
|
17 |
|
| 18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
| 19 |
|
19 |
|
| 20 |
use Test::More tests => 2; |
20 |
use Test::More tests => 3; |
| 21 |
use Test::MockModule; |
21 |
use Test::MockModule; |
| 22 |
use Test::Warn; |
22 |
use Test::Warn; |
| 23 |
|
23 |
|
|
Lines 58-67
Koha::CirculationRules->set_rule(
Link Here
|
| 58 |
|
58 |
|
| 59 |
$branch = $builder->build( { source => 'Branch' } )->{branchcode}; |
59 |
$branch = $builder->build( { source => 'Branch' } )->{branchcode}; |
| 60 |
|
60 |
|
| 61 |
subtest 'Test Koha::Checkout::claim_returned' => sub { |
61 |
subtest 'Test Koha::Checkout::claim_returned, do not mark as returned' => sub { |
| 62 |
plan tests => 6; |
62 |
plan tests => 7; |
| 63 |
|
63 |
|
| 64 |
t::lib::Mocks::mock_preference( 'ClaimReturnedLostValue', 1 ); |
64 |
t::lib::Mocks::mock_preference( 'ClaimReturnedLostValue', 1 ); |
|
|
65 |
t::lib::Mocks::mock_preference( 'MarkLostItemsAsReturned', q{} ); |
| 65 |
my $biblio = $builder->build_object( { class => 'Koha::Biblios' } ); |
66 |
my $biblio = $builder->build_object( { class => 'Koha::Biblios' } ); |
| 66 |
my $item = $builder->build_object( |
67 |
my $item = $builder->build_object( |
| 67 |
{ |
68 |
{ |
|
Lines 90-95
subtest 'Test Koha::Checkout::claim_returned' => sub {
Link Here
|
| 90 |
is( $claim->notes, "Test note", "Claim notes match" ); |
91 |
is( $claim->notes, "Test note", "Claim notes match" ); |
| 91 |
is( $claim->created_by, $patron->id, "Claim created_by matches" ); |
92 |
is( $claim->created_by, $patron->id, "Claim created_by matches" ); |
| 92 |
ok( $claim->created_on, "Claim created_on is set" ); |
93 |
ok( $claim->created_on, "Claim created_on is set" ); |
|
|
94 |
|
| 95 |
my $checkout2 = Koha::Checkouts->find( $checkout->id ); |
| 96 |
is( $checkout2->id, $checkout->id, "Item is still checked out to patron") |
| 93 |
}; |
97 |
}; |
| 94 |
|
98 |
|
| 95 |
subtest 'Test Koha::Patronn::return_claims' => sub { |
99 |
subtest 'Test Koha::Patronn::return_claims' => sub { |
|
Lines 132-135
subtest 'Test Koha::Patronn::return_claims' => sub {
Link Here
|
| 132 |
ok( $claim->created_on, "Claim created_on is set" ); |
136 |
ok( $claim->created_on, "Claim created_on is set" ); |
| 133 |
}; |
137 |
}; |
| 134 |
|
138 |
|
|
|
139 |
subtest 'Test Koha::Checkout::claim_returned, mark as returned' => sub { |
| 140 |
plan tests => 8; |
| 141 |
|
| 142 |
t::lib::Mocks::mock_preference( 'ClaimReturnedLostValue', 1 ); |
| 143 |
t::lib::Mocks::mock_preference( 'MarkLostItemsAsReturned', q{claim_returned} ); |
| 144 |
my $biblio = $builder->build_object( { class => 'Koha::Biblios' } ); |
| 145 |
my $item = $builder->build_object( |
| 146 |
{ |
| 147 |
class => 'Koha::Items', |
| 148 |
value => { |
| 149 |
biblionumber => $biblio->biblionumber, |
| 150 |
notforloan => 0, |
| 151 |
itemlost => 0, |
| 152 |
withdrawn => 0, |
| 153 |
} |
| 154 |
} |
| 155 |
); |
| 156 |
my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); |
| 157 |
my $checkout = AddIssue( $patron->unblessed, $item->barcode ); |
| 158 |
|
| 159 |
my $claim = $checkout->claim_returned( |
| 160 |
{ |
| 161 |
created_by => $patron->id, |
| 162 |
notes => "Test note", |
| 163 |
} |
| 164 |
); |
| 165 |
|
| 166 |
is( $claim->issue_id, $checkout->id, "Claim issue id matches" ); |
| 167 |
is( $claim->itemnumber, $item->id, "Claim itemnumber matches" ); |
| 168 |
is( $claim->borrowernumber, $patron->id, "Claim borrowernumber matches" ); |
| 169 |
is( $claim->notes, "Test note", "Claim notes match" ); |
| 170 |
is( $claim->created_by, $patron->id, "Claim created_by matches" ); |
| 171 |
ok( $claim->created_on, "Claim created_on is set" ); |
| 172 |
|
| 173 |
my $checkout2 = Koha::Checkouts->find( $checkout->id ); |
| 174 |
is( $checkout2, undef, "Checkout is not longer in the issues table"); |
| 175 |
$checkout2 = Koha::Old::Checkouts->find( $checkout->id ); |
| 176 |
is( $checkout2->id, $checkout->id, "Checkout was foudn in the old_issues table"); |
| 177 |
}; |
| 178 |
|
| 135 |
$schema->storage->txn_rollback; |
179 |
$schema->storage->txn_rollback; |
| 136 |
- |
|
|