|
Lines 19-25
Link Here
|
| 19 |
|
19 |
|
| 20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
| 21 |
|
21 |
|
| 22 |
use Test::More tests => 19; |
22 |
use Test::More tests => 20; |
| 23 |
use Test::Exception; |
23 |
use Test::Exception; |
| 24 |
use Test::Warn; |
24 |
use Test::Warn; |
| 25 |
|
25 |
|
|
Lines 29-34
use Koha::DateUtils qw(dt_from_string);
Link Here
|
| 29 |
use Koha::ArticleRequests; |
29 |
use Koha::ArticleRequests; |
| 30 |
use Koha::Patrons; |
30 |
use Koha::Patrons; |
| 31 |
use Koha::Patron::Relationships; |
31 |
use Koha::Patron::Relationships; |
|
|
32 |
use C4::Circulation qw( AddIssue AddReturn ); |
| 32 |
|
33 |
|
| 33 |
use t::lib::TestBuilder; |
34 |
use t::lib::TestBuilder; |
| 34 |
use t::lib::Mocks; |
35 |
use t::lib::Mocks; |
|
Lines 1349-1351
subtest 'notify_library_of_registration()' => sub {
Link Here
|
| 1349 |
|
1350 |
|
| 1350 |
$schema->storage->txn_rollback; |
1351 |
$schema->storage->txn_rollback; |
| 1351 |
}; |
1352 |
}; |
| 1352 |
- |
1353 |
|
|
|
1354 |
subtest 'get_savings tests' => sub { |
| 1355 |
plan tests => 2; |
| 1356 |
|
| 1357 |
$schema->storage->txn_begin; |
| 1358 |
|
| 1359 |
my $library = $builder->build_object({ class => 'Koha::Libraries' }); |
| 1360 |
my $patron = $builder->build_object({ class => 'Koha::Patrons' }, { value => { branchcode => $library->branchcode } }); |
| 1361 |
|
| 1362 |
t::lib::Mocks::mock_userenv({ patron => $patron, branchcode => $library->branchcode }); |
| 1363 |
|
| 1364 |
my $biblio1 = $builder->build_object({ class => 'Koha::Biblios' }); |
| 1365 |
my $item1 = $builder->build_object({ class => 'Koha::Items' }, { value => { biblionumber => $biblio1->biblionumber, replacementprice => '5.00', holdingbranch => $library->branchcode, homebranch => $library->branchcode } }); |
| 1366 |
my $item2 = $builder->build_object({ class => 'Koha::Items' }, { value => { biblionumber => $biblio1->biblionumber, replacementprice => '5.00', holdingbranch => $library->branchcode, homebranch => $library->branchcode } }); |
| 1367 |
|
| 1368 |
AddIssue( $patron->unblessed, $item1->barcode ); |
| 1369 |
AddIssue( $patron->unblessed, $item2->barcode ); |
| 1370 |
|
| 1371 |
my $savings = $patron->get_savings; |
| 1372 |
is( $savings, $item1->replacementprice + $item2->replacementprice, "Savings correctly calculated from current issues" ); |
| 1373 |
|
| 1374 |
AddReturn( $item2->barcode, $item2->homebranch ); |
| 1375 |
|
| 1376 |
$savings = $patron->get_savings; |
| 1377 |
is( $savings, $item1->replacementprice + $item2->replacementprice, "Savings correctly calculated from current and old issues" ); |
| 1378 |
|
| 1379 |
$schema->storage->txn_rollback; |
| 1380 |
}; |