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

(-)a/t/db_dependent/Circulation.t (-11 / +11 lines)
Lines 33-39 use t::lib::Mocks; Link Here
33
use t::lib::TestBuilder;
33
use t::lib::TestBuilder;
34
34
35
use C4::Accounts;
35
use C4::Accounts;
36
use C4::Calendar qw( new insert_single_holiday insert_week_day_holiday delete_holiday );
36
use C4::Calendar;
37
use C4::Circulation
37
use C4::Circulation
38
    qw( AddIssue AddReturn CanBookBeRenewed GetIssuingCharges AddRenewal GetSoonestRenewDate GetLatestAutoRenewDate LostItem GetUpcomingDueIssues CanBookBeIssued AddIssuingCharge MarkIssueReturned ProcessOfflinePayment transferbook );
38
    qw( AddIssue AddReturn CanBookBeRenewed GetIssuingCharges AddRenewal GetSoonestRenewDate GetLatestAutoRenewDate LostItem GetUpcomingDueIssues CanBookBeIssued AddIssuingCharge MarkIssueReturned ProcessOfflinePayment transferbook );
39
use C4::Biblio;
39
use C4::Biblio;
Lines 1182-1188 subtest "CanBookBeRenewed tests" => sub { Link Here
1182
        );
1182
        );
1183
1183
1184
        my $ten_days_before = dt_from_string->add( days => -10 );
1184
        my $ten_days_before = dt_from_string->add( days => -10 );
1185
        my $ten_days_ahead  = dt_from_string->add( days => 10 );
1185
        my $ten_days_ahead  = dt_from_string->add( days =>  10 );
1186
        my $issue           = AddIssue(
1186
        my $issue           = AddIssue(
1187
            $renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before,
1187
            $renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before,
1188
            undef, { auto_renew => 1 }
1188
            undef, { auto_renew => 1 }
Lines 1332-1338 subtest "CanBookBeRenewed tests" => sub { Link Here
1332
        );
1332
        );
1333
1333
1334
        my $ten_days_before = dt_from_string->add( days => -10 );
1334
        my $ten_days_before = dt_from_string->add( days => -10 );
1335
        my $ten_days_ahead  = dt_from_string->add( days => 10 );
1335
        my $ten_days_ahead  = dt_from_string->add( days =>  10 );
1336
        my $issue           = AddIssue(
1336
        my $issue           = AddIssue(
1337
            $renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before,
1337
            $renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before,
1338
            undef, { auto_renew => 1 }
1338
            undef, { auto_renew => 1 }
Lines 1442-1448 subtest "CanBookBeRenewed tests" => sub { Link Here
1442
        );
1442
        );
1443
1443
1444
        my $ten_days_before = dt_from_string->add( days => -10 );
1444
        my $ten_days_before = dt_from_string->add( days => -10 );
1445
        my $ten_days_ahead  = dt_from_string->add( days => 10 );
1445
        my $ten_days_ahead  = dt_from_string->add( days =>  10 );
1446
1446
1447
        # Patron is expired and BlockExpiredPatronOpacActions=''
1447
        # Patron is expired and BlockExpiredPatronOpacActions=''
1448
        # => auto renew is allowed
1448
        # => auto renew is allowed
Lines 1494-1500 subtest "CanBookBeRenewed tests" => sub { Link Here
1494
        );
1494
        );
1495
1495
1496
        my $ten_days_before = dt_from_string->add( days => -10 );
1496
        my $ten_days_before = dt_from_string->add( days => -10 );
1497
        my $ten_days_ahead  = dt_from_string->add( days => 10 );
1497
        my $ten_days_ahead  = dt_from_string->add( days =>  10 );
1498
        my $issue           = AddIssue(
1498
        my $issue           = AddIssue(
1499
            $renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before,
1499
            $renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before,
1500
            undef, { auto_renew => 1 }
1500
            undef, { auto_renew => 1 }
Lines 1615-1621 subtest "CanBookBeRenewed tests" => sub { Link Here
1615
        );
1615
        );
1616
1616
1617
        my $ten_days_before = dt_from_string->add( days => -10 );
1617
        my $ten_days_before = dt_from_string->add( days => -10 );
1618
        my $ten_days_ahead  = dt_from_string->add( days => 10 );
1618
        my $ten_days_ahead  = dt_from_string->add( days =>  10 );
1619
        my $issue           = AddIssue(
1619
        my $issue           = AddIssue(
1620
            $renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before,
1620
            $renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before,
1621
            undef, { auto_renew => 1 }
1621
            undef, { auto_renew => 1 }
Lines 1966-1972 subtest "GetUpcomingDueIssues" => sub { Link Here
1966
    my $a_borrower                = Koha::Patrons->find($a_borrower_borrowernumber);
1966
    my $a_borrower                = Koha::Patrons->find($a_borrower_borrowernumber);
1967
1967
1968
    my $yesterday      = DateTime->today( time_zone => C4::Context->tz() )->add( days => -1 );
1968
    my $yesterday      = DateTime->today( time_zone => C4::Context->tz() )->add( days => -1 );
1969
    my $two_days_ahead = DateTime->today( time_zone => C4::Context->tz() )->add( days => 2 );
1969
    my $two_days_ahead = DateTime->today( time_zone => C4::Context->tz() )->add( days =>  2 );
1970
    my $today          = DateTime->today( time_zone => C4::Context->tz() );
1970
    my $today          = DateTime->today( time_zone => C4::Context->tz() );
1971
1971
1972
    my $issue    = AddIssue( $a_borrower, $item_1->barcode, $yesterday );
1972
    my $issue    = AddIssue( $a_borrower, $item_1->barcode, $yesterday );
Lines 3878-3884 subtest 'AddReturn | is_overdue' => sub { Link Here
3878
        is( $line->status,                'RETURNED', "Overdue fine is fixed" );
3878
        is( $line->status,                'RETURNED', "Overdue fine is fixed" );
3879
        $line = $lines->next;
3879
        $line = $lines->next;
3880
        is( $line->amount + 0,            -2, "Original payment amount remains as 2" );
3880
        is( $line->amount + 0,            -2, "Original payment amount remains as 2" );
3881
        is( $line->amountoutstanding + 0, 0,  "Original payment remains applied" );
3881
        is( $line->amountoutstanding + 0,  0, "Original payment remains applied" );
3882
        $line = $lines->next;
3882
        $line = $lines->next;
3883
        is( $line->amount + 0,            -1, "Refund amount correctly set to 1" );
3883
        is( $line->amount + 0,            -1, "Refund amount correctly set to 1" );
3884
        is( $line->amountoutstanding + 0, -1, "Refund amount outstanding unspent" );
3884
        is( $line->amountoutstanding + 0, -1, "Refund amount outstanding unspent" );
Lines 4831-4837 subtest '_FixOverduesOnReturn' => sub { Link Here
4831
    my $credit = $offset->credit;
4831
    my $credit = $offset->credit;
4832
    is( ref $credit,                    "Koha::Account::Line", "Found matching credit for fine forgiveness" );
4832
    is( ref $credit,                    "Koha::Account::Line", "Found matching credit for fine forgiveness" );
4833
    is( $credit->amount + 0,            -99,                   "Credit amount is set correctly" );
4833
    is( $credit->amount + 0,            -99,                   "Credit amount is set correctly" );
4834
    is( $credit->amountoutstanding + 0, 0,                     "Credit amountoutstanding is correctly set to 0" );
4834
    is( $credit->amountoutstanding + 0,  0,                    "Credit amountoutstanding is correctly set to 0" );
4835
4835
4836
    # Bug 25417 - Only forgive fines where there is an amount outstanding to forgive
4836
    # Bug 25417 - Only forgive fines where there is an amount outstanding to forgive
4837
    $accountline->set(
4837
    $accountline->set(
Lines 7484-7490 subtest 'NoRefundOnLostFinesPaidAge' => sub { Link Here
7484
        {
7484
        {
7485
            borrowernumber    => $patron->id,
7485
            borrowernumber    => $patron->id,
7486
            date              => '1970-01-01 14:00:01',
7486
            date              => '1970-01-01 14:00:01',
7487
            amountoutstanding => 0,
7487
            amountoutstanding =>  0,
7488
            amount            => -5,
7488
            amount            => -5,
7489
            interface         => 'commandline',
7489
            interface         => 'commandline',
7490
            credit_type_code  => 'PAYMENT'
7490
            credit_type_code  => 'PAYMENT'
Lines 7540-7546 subtest 'NoRefundOnLostFinesPaidAge' => sub { Link Here
7540
            borrowernumber    => $patron2->id,
7540
            borrowernumber    => $patron2->id,
7541
            date              => '1970-01-01 14:00:01',
7541
            date              => '1970-01-01 14:00:01',
7542
            amount            => -5,
7542
            amount            => -5,
7543
            amountoutstanding => 0,
7543
            amountoutstanding =>  0,
7544
            interface         => 'commandline',
7544
            interface         => 'commandline',
7545
            credit_type_code  => 'PAYMENT'
7545
            credit_type_code  => 'PAYMENT'
7546
        }
7546
        }
(-)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