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

(-)a/t/db_dependent/Accounts.t (-4 / +4 lines)
Lines 798-804 subtest "Koha::Account::non_issues_charges tests" => sub { Link Here
798
};
798
};
799
799
800
subtest "Koha::Account::non_issues_charges tests" => sub {
800
subtest "Koha::Account::non_issues_charges tests" => sub {
801
    plan tests => 6;
801
    plan tests => 9;
802
802
803
    my $patron = $builder->build_object(
803
    my $patron = $builder->build_object(
804
        {
804
        {
Lines 820-827 subtest "Koha::Account::non_issues_charges tests" => sub { Link Here
820
    my $credit_2 = Koha::Account::Lines->find( $credit->id );
820
    my $credit_2 = Koha::Account::Lines->find( $credit->id );
821
    ok( $debit_2, 'Debit was correctly not deleted when credit has balance' );
821
    ok( $debit_2, 'Debit was correctly not deleted when credit has balance' );
822
    ok( $credit_2, 'Credit was correctly not deleted when credit has balance' );
822
    ok( $credit_2, 'Credit was correctly not deleted when credit has balance' );
823
    is( Koha::Account::Lines->count({ borrowernumber => $patron->id }), 2, "The 2 account lines still exists" );
823
824
824
    $dbh->do(q|DELETE FROM accountlines WHERE borrowernumber=?|, undef, $patron->id);
825
    $debit = Koha::Account::Line->new({ borrowernumber => $patron->id, date => '1900-01-01', amountoutstanding => 5 })->store();
825
    $debit = Koha::Account::Line->new({ borrowernumber => $patron->id, date => '1900-01-01', amountoutstanding => 5 })->store();
826
    $credit = Koha::Account::Line->new({ borrowernumber => $patron->id, date => '1900-01-01', amountoutstanding => 0 })->store();
826
    $credit = Koha::Account::Line->new({ borrowernumber => $patron->id, date => '1900-01-01', amountoutstanding => 0 })->store();
827
    $offset = Koha::Account::Offset->new({ credit_id => $credit->id, debit_id => $debit->id, type => 'Payment' })->store();
827
    $offset = Koha::Account::Offset->new({ credit_id => $credit->id, debit_id => $debit->id, type => 'Payment' })->store();
Lines 831-838 subtest "Koha::Account::non_issues_charges tests" => sub { Link Here
831
    $credit_2 = Koha::Account::Lines->find( $credit->id );
831
    $credit_2 = Koha::Account::Lines->find( $credit->id );
832
    ok( $debit_2, 'Debit was correctly not deleted when debit has balance' );
832
    ok( $debit_2, 'Debit was correctly not deleted when debit has balance' );
833
    ok( $credit_2, 'Credit was correctly not deleted when debit has balance' );
833
    ok( $credit_2, 'Credit was correctly not deleted when debit has balance' );
834
    is( Koha::Account::Lines->count({ borrowernumber => $patron->id }), 2 + 2, "The 2 + 2 account lines still exists" );
834
835
835
    $dbh->do(q|DELETE FROM accountlines WHERE borrowernumber=?|, undef, $patron->id);
836
    $debit = Koha::Account::Line->new({ borrowernumber => $patron->id, date => '1900-01-01', amountoutstanding => 0 })->store();
836
    $debit = Koha::Account::Line->new({ borrowernumber => $patron->id, date => '1900-01-01', amountoutstanding => 0 })->store();
837
    $credit = Koha::Account::Line->new({ borrowernumber => $patron->id, date => '1900-01-01', amountoutstanding => 0 })->store();
837
    $credit = Koha::Account::Line->new({ borrowernumber => $patron->id, date => '1900-01-01', amountoutstanding => 0 })->store();
838
    $offset = Koha::Account::Offset->new({ credit_id => $credit->id, debit_id => $debit->id, type => 'Payment' })->store();
838
    $offset = Koha::Account::Offset->new({ credit_id => $credit->id, debit_id => $debit->id, type => 'Payment' })->store();
Lines 841-846 subtest "Koha::Account::non_issues_charges tests" => sub { Link Here
841
    $credit_2 = Koha::Account::Lines->find( $credit->id );
841
    $credit_2 = Koha::Account::Lines->find( $credit->id );
842
    ok( !$debit_2, 'Debit was correctly deleted' );
842
    ok( !$debit_2, 'Debit was correctly deleted' );
843
    ok( !$credit_2, 'Credit was correctly deleted' );
843
    ok( !$credit_2, 'Credit was correctly deleted' );
844
    is( Koha::Account::Lines->count({ borrowernumber => $patron->id }), 2 + 2, "The 2 + 2 account lines still exists, the last 2 have been deleted ok" );
844
};
845
};
845
846
846
1;
847
1;
847
- 

Return to bug 20325