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

(-)a/t/db_dependent/Circulation.t (-11 / +11 lines)
Lines 34-40 use t::lib::Mocks; Link Here
34
use t::lib::TestBuilder;
34
use t::lib::TestBuilder;
35
35
36
use C4::Accounts;
36
use C4::Accounts;
37
use C4::Calendar qw( new insert_single_holiday insert_week_day_holiday delete_holiday );
37
use C4::Calendar;
38
use C4::Circulation
38
use C4::Circulation
39
    qw( AddIssue AddReturn CanBookBeRenewed GetIssuingCharges AddRenewal GetSoonestRenewDate GetLatestAutoRenewDate LostItem GetUpcomingDueIssues CanBookBeIssued AddIssuingCharge MarkIssueReturned ProcessOfflinePayment transferbook );
39
    qw( AddIssue AddReturn CanBookBeRenewed GetIssuingCharges AddRenewal GetSoonestRenewDate GetLatestAutoRenewDate LostItem GetUpcomingDueIssues CanBookBeIssued AddIssuingCharge MarkIssueReturned ProcessOfflinePayment transferbook );
40
use C4::Biblio;
40
use C4::Biblio;
Lines 1183-1189 subtest "CanBookBeRenewed tests" => sub { Link Here
1183
        );
1183
        );
1184
1184
1185
        my $ten_days_before = dt_from_string->add( days => -10 );
1185
        my $ten_days_before = dt_from_string->add( days => -10 );
1186
        my $ten_days_ahead  = dt_from_string->add( days => 10 );
1186
        my $ten_days_ahead  = dt_from_string->add( days =>  10 );
1187
        my $issue           = AddIssue(
1187
        my $issue           = AddIssue(
1188
            $renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before,
1188
            $renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before,
1189
            undef, { auto_renew => 1 }
1189
            undef, { auto_renew => 1 }
Lines 1333-1339 subtest "CanBookBeRenewed tests" => sub { Link Here
1333
        );
1333
        );
1334
1334
1335
        my $ten_days_before = dt_from_string->add( days => -10 );
1335
        my $ten_days_before = dt_from_string->add( days => -10 );
1336
        my $ten_days_ahead  = dt_from_string->add( days => 10 );
1336
        my $ten_days_ahead  = dt_from_string->add( days =>  10 );
1337
        my $issue           = AddIssue(
1337
        my $issue           = AddIssue(
1338
            $renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before,
1338
            $renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before,
1339
            undef, { auto_renew => 1 }
1339
            undef, { auto_renew => 1 }
Lines 1443-1449 subtest "CanBookBeRenewed tests" => sub { Link Here
1443
        );
1443
        );
1444
1444
1445
        my $ten_days_before = dt_from_string->add( days => -10 );
1445
        my $ten_days_before = dt_from_string->add( days => -10 );
1446
        my $ten_days_ahead  = dt_from_string->add( days => 10 );
1446
        my $ten_days_ahead  = dt_from_string->add( days =>  10 );
1447
1447
1448
        # Patron is expired and BlockExpiredPatronOpacActions=''
1448
        # Patron is expired and BlockExpiredPatronOpacActions=''
1449
        # => auto renew is allowed
1449
        # => auto renew is allowed
Lines 1495-1501 subtest "CanBookBeRenewed tests" => sub { Link Here
1495
        );
1495
        );
1496
1496
1497
        my $ten_days_before = dt_from_string->add( days => -10 );
1497
        my $ten_days_before = dt_from_string->add( days => -10 );
1498
        my $ten_days_ahead  = dt_from_string->add( days => 10 );
1498
        my $ten_days_ahead  = dt_from_string->add( days =>  10 );
1499
        my $issue           = AddIssue(
1499
        my $issue           = AddIssue(
1500
            $renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before,
1500
            $renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before,
1501
            undef, { auto_renew => 1 }
1501
            undef, { auto_renew => 1 }
Lines 1616-1622 subtest "CanBookBeRenewed tests" => sub { Link Here
1616
        );
1616
        );
1617
1617
1618
        my $ten_days_before = dt_from_string->add( days => -10 );
1618
        my $ten_days_before = dt_from_string->add( days => -10 );
1619
        my $ten_days_ahead  = dt_from_string->add( days => 10 );
1619
        my $ten_days_ahead  = dt_from_string->add( days =>  10 );
1620
        my $issue           = AddIssue(
1620
        my $issue           = AddIssue(
1621
            $renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before,
1621
            $renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before,
1622
            undef, { auto_renew => 1 }
1622
            undef, { auto_renew => 1 }
Lines 1967-1973 subtest "GetUpcomingDueIssues" => sub { Link Here
1967
    my $a_borrower                = Koha::Patrons->find($a_borrower_borrowernumber);
1967
    my $a_borrower                = Koha::Patrons->find($a_borrower_borrowernumber);
1968
1968
1969
    my $yesterday      = DateTime->today( time_zone => C4::Context->tz() )->add( days => -1 );
1969
    my $yesterday      = DateTime->today( time_zone => C4::Context->tz() )->add( days => -1 );
1970
    my $two_days_ahead = DateTime->today( time_zone => C4::Context->tz() )->add( days => 2 );
1970
    my $two_days_ahead = DateTime->today( time_zone => C4::Context->tz() )->add( days =>  2 );
1971
    my $today          = DateTime->today( time_zone => C4::Context->tz() );
1971
    my $today          = DateTime->today( time_zone => C4::Context->tz() );
1972
1972
1973
    my $issue    = AddIssue( $a_borrower, $item_1->barcode, $yesterday );
1973
    my $issue    = AddIssue( $a_borrower, $item_1->barcode, $yesterday );
Lines 3879-3885 subtest 'AddReturn | is_overdue' => sub { Link Here
3879
        is( $line->status,                'RETURNED', "Overdue fine is fixed" );
3879
        is( $line->status,                'RETURNED', "Overdue fine is fixed" );
3880
        $line = $lines->next;
3880
        $line = $lines->next;
3881
        is( $line->amount + 0,            -2, "Original payment amount remains as 2" );
3881
        is( $line->amount + 0,            -2, "Original payment amount remains as 2" );
3882
        is( $line->amountoutstanding + 0, 0,  "Original payment remains applied" );
3882
        is( $line->amountoutstanding + 0,  0, "Original payment remains applied" );
3883
        $line = $lines->next;
3883
        $line = $lines->next;
3884
        is( $line->amount + 0,            -1, "Refund amount correctly set to 1" );
3884
        is( $line->amount + 0,            -1, "Refund amount correctly set to 1" );
3885
        is( $line->amountoutstanding + 0, -1, "Refund amount outstanding unspent" );
3885
        is( $line->amountoutstanding + 0, -1, "Refund amount outstanding unspent" );
Lines 4833-4839 subtest '_FixOverduesOnReturn' => sub { Link Here
4833
    my $credit = $offset->credit;
4833
    my $credit = $offset->credit;
4834
    is( ref $credit,                    "Koha::Account::Line", "Found matching credit for fine forgiveness" );
4834
    is( ref $credit,                    "Koha::Account::Line", "Found matching credit for fine forgiveness" );
4835
    is( $credit->amount + 0,            -99,                   "Credit amount is set correctly" );
4835
    is( $credit->amount + 0,            -99,                   "Credit amount is set correctly" );
4836
    is( $credit->amountoutstanding + 0, 0,                     "Credit amountoutstanding is correctly set to 0" );
4836
    is( $credit->amountoutstanding + 0,  0,                    "Credit amountoutstanding is correctly set to 0" );
4837
4837
4838
    # Bug 25417 - Only forgive fines where there is an amount outstanding to forgive
4838
    # Bug 25417 - Only forgive fines where there is an amount outstanding to forgive
4839
    $accountline->set(
4839
    $accountline->set(
Lines 7584-7590 subtest 'NoRefundOnLostFinesPaidAge' => sub { Link Here
7584
        {
7584
        {
7585
            borrowernumber    => $patron->id,
7585
            borrowernumber    => $patron->id,
7586
            date              => '1970-01-01 14:00:01',
7586
            date              => '1970-01-01 14:00:01',
7587
            amountoutstanding => 0,
7587
            amountoutstanding =>  0,
7588
            amount            => -5,
7588
            amount            => -5,
7589
            interface         => 'commandline',
7589
            interface         => 'commandline',
7590
            credit_type_code  => 'PAYMENT'
7590
            credit_type_code  => 'PAYMENT'
Lines 7640-7646 subtest 'NoRefundOnLostFinesPaidAge' => sub { Link Here
7640
            borrowernumber    => $patron2->id,
7640
            borrowernumber    => $patron2->id,
7641
            date              => '1970-01-01 14:00:01',
7641
            date              => '1970-01-01 14:00:01',
7642
            amount            => -5,
7642
            amount            => -5,
7643
            amountoutstanding => 0,
7643
            amountoutstanding =>  0,
7644
            interface         => 'commandline',
7644
            interface         => 'commandline',
7645
            credit_type_code  => 'PAYMENT'
7645
            credit_type_code  => 'PAYMENT'
7646
        }
7646
        }
(-)a/t/db_dependent/Circulation/CalcDateDue.t (-1 / +1 lines)
Lines 9-15 use DBI; Link Here
9
use DateTime;
9
use DateTime;
10
use t::lib::Mocks;
10
use t::lib::Mocks;
11
use t::lib::TestBuilder;
11
use t::lib::TestBuilder;
12
use C4::Calendar    qw( new insert_single_holiday delete_holiday insert_week_day_holiday );
12
use C4::Calendar;
13
use Koha::DateUtils qw( dt_from_string );
13
use Koha::DateUtils qw( dt_from_string );
14
use Koha::Library::Hours;
14
use Koha::Library::Hours;
15
use Koha::CirculationRules;
15
use Koha::CirculationRules;
(-)a/t/db_dependent/Hold.t (-7 / +13 lines)
Lines 22-28 use C4::Context; Link Here
22
use C4::Biblio qw( AddBiblio );
22
use C4::Biblio qw( AddBiblio );
23
use Koha::Database;
23
use Koha::Database;
24
use Koha::Libraries;
24
use Koha::Libraries;
25
use C4::Calendar qw( new insert_single_holiday );
25
use C4::Calendar;
26
use Koha::Patrons;
26
use Koha::Patrons;
27
use Koha::Holds;
27
use Koha::Holds;
28
use Koha::Item;
28
use Koha::Item;
Lines 356-363 subtest "delete() tests" => sub { Link Here
356
        "Koha::Hold->delete should have deleted the hold"
356
        "Koha::Hold->delete should have deleted the hold"
357
    );
357
    );
358
358
359
    my $number_of_logs = $schema->resultset('ActionLog')
359
    my $number_of_logs =
360
        ->search( { module => 'HOLDS', action => 'DELETE', object => $hold->{reserve_id} } )->count;
360
        $schema->resultset('ActionLog')
361
        ->search( { module => 'HOLDS', action => 'DELETE', object => $hold->{reserve_id} } )
362
        ->count;
361
    is( $number_of_logs, 0, 'With HoldsLogs, Koha::Hold->delete shouldn\'t have been logged' );
363
    is( $number_of_logs, 0, 'With HoldsLogs, Koha::Hold->delete shouldn\'t have been logged' );
362
364
363
    # Enable logging
365
    # Enable logging
Lines 376-383 subtest "delete() tests" => sub { Link Here
376
        "Koha::Hold->delete should have deleted the hold"
378
        "Koha::Hold->delete should have deleted the hold"
377
    );
379
    );
378
380
379
    $number_of_logs = $schema->resultset('ActionLog')
381
    $number_of_logs =
380
        ->search( { module => 'HOLDS', action => 'DELETE', object => $hold->{reserve_id} } )->count;
382
        $schema->resultset('ActionLog')
383
        ->search( { module => 'HOLDS', action => 'DELETE', object => $hold->{reserve_id} } )
384
        ->count;
381
    is( $number_of_logs, 1, 'With HoldsLogs, Koha::Hold->delete should have been logged' );
385
    is( $number_of_logs, 1, 'With HoldsLogs, Koha::Hold->delete should have been logged' );
382
386
383
    $schema->storage->txn_rollback();
387
    $schema->storage->txn_rollback();
Lines 469-475 subtest 'suspend() tests' => sub { Link Here
469
    t::lib::Mocks::mock_preference( 'HoldsLog', 1 );
473
    t::lib::Mocks::mock_preference( 'HoldsLog', 1 );
470
474
471
    my $logs_count =
475
    my $logs_count =
472
        $schema->resultset('ActionLog')->search( { module => 'HOLDS', action => 'SUSPEND', object => $hold->id } )
476
        $schema->resultset('ActionLog')
477
        ->search( { module => 'HOLDS', action => 'SUSPEND', object => $hold->id } )
473
        ->count;
478
        ->count;
474
479
475
    $hold = $builder->build_object(
480
    $hold = $builder->build_object(
Lines 481-487 subtest 'suspend() tests' => sub { Link Here
481
486
482
    $hold->suspend_hold;
487
    $hold->suspend_hold;
483
    my $new_logs_count =
488
    my $new_logs_count =
484
        $schema->resultset('ActionLog')->search( { module => 'HOLDS', action => 'SUSPEND', object => $hold->id } )
489
        $schema->resultset('ActionLog')
490
        ->search( { module => 'HOLDS', action => 'SUSPEND', object => $hold->id } )
485
        ->count;
491
        ->count;
486
492
487
    is( $new_logs_count, $logs_count + 1, 'If logging is enabled, suspending a hold gets logged' );
493
    is( $new_logs_count, $logs_count + 1, 'If logging is enabled, suspending a hold gets logged' );
(-)a/t/db_dependent/HoldsQueue.t (-1 / +1 lines)
Lines 12-18 use Test::NoWarnings; Link Here
12
use Test::More tests => 65;
12
use Test::More tests => 65;
13
use Data::Dumper;
13
use Data::Dumper;
14
14
15
use C4::Calendar qw( new insert_single_holiday );
15
use C4::Calendar;
16
use C4::Context;
16
use C4::Context;
17
use C4::Members;
17
use C4::Members;
18
use C4::Circulation qw( AddIssue AddReturn );
18
use C4::Circulation qw( AddIssue AddReturn );
(-)a/t/db_dependent/Koha/Charges/Fees.t (-1 / +1 lines)
Lines 29-35 use t::lib::TestBuilder; Link Here
29
use t::lib::Dates;
29
use t::lib::Dates;
30
30
31
use Time::Fake;
31
use Time::Fake;
32
use C4::Calendar    qw( new insert_week_day_holiday delete_holiday );
32
use C4::Calendar;
33
use Koha::DateUtils qw(dt_from_string);
33
use Koha::DateUtils qw(dt_from_string);
34
34
35
BEGIN {
35
BEGIN {
(-)a/t/db_dependent/Koha/ItemTypes.t (-2 / +1 lines)
Lines 25-31 use Test::More tests => 19; Link Here
25
use t::lib::Mocks;
25
use t::lib::Mocks;
26
use t::lib::TestBuilder;
26
use t::lib::TestBuilder;
27
27
28
use C4::Calendar qw( new );
28
use C4::Calendar;
29
use Koha::Biblioitems;
29
use Koha::Biblioitems;
30
use Koha::Libraries;
30
use Koha::Libraries;
31
use Koha::Database;
31
use Koha::Database;
32
- 

Return to bug 40680