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

(-)a/t/db_dependent/Koha/Account.t (-2 / +40 lines)
Lines 684-690 subtest 'reconcile_balance' => sub { Link Here
684
684
685
subtest 'pay() tests' => sub {
685
subtest 'pay() tests' => sub {
686
686
687
    plan tests => 5;
687
    plan tests => 6;
688
688
689
    $schema->storage->txn_begin;
689
    $schema->storage->txn_begin;
690
690
Lines 738-743 subtest 'pay() tests' => sub { Link Here
738
    my $payment = Koha::Account::Lines->find({accountlines_id => $result->{payment_id}});
738
    my $payment = Koha::Account::Lines->find({accountlines_id => $result->{payment_id}});
739
    is($payment->manager_id, undef, "manager_id left undefined when no userenv found");
739
    is($payment->manager_id, undef, "manager_id left undefined when no userenv found");
740
740
741
    subtest 'UseEmailReceipts tests' => sub {
742
743
        plan tests => 5;
744
745
        t::lib::Mocks::mock_preference( 'UseEmailReceipts', 1 );
746
747
        my %params;
748
749
        my $mocked_letters = Test::MockModule->new('C4::Letters');
750
        # we want to test the params
751
        $mocked_letters->mock( 'GetPreparedLetter', sub {
752
            %params = @_;
753
            return 1;
754
        });
755
        # we don't care about EnqueueLetter for now
756
        $mocked_letters->mock( 'EnqueueLetter', sub {
757
            return 1;
758
        });
759
760
        $schema->storage->txn_begin;
761
762
        my $patron  = $builder->build_object({ class => 'Koha::Patrons' });
763
        my $account = $patron->account;
764
765
        my $debit_1 = $account->add_debit( { amount => 5,  interface => 'commandline', type => 'OVERDUE' } );
766
        my $debit_2 = $account->add_debit( { amount => 10,  interface => 'commandline', type => 'OVERDUE' } );
767
768
        $account->pay({ amount => 6, lines => [ $debit_1, $debit_2 ] });
769
        my @offsets = @{$params{substitute}{offsets}};
770
771
        is( scalar @offsets, 2, 'Two offsets related to payment' );
772
        is( ref($offsets[0]), 'Koha::Account::Offset', 'Type is correct' );
773
        is( ref($offsets[1]), 'Koha::Account::Offset', 'Type is correct' );
774
        is( $offsets[0]->type, 'APPLY', 'Only APPLY offsets are passed to the notice' );
775
        is( $offsets[1]->type, 'APPLY', 'Only APPLY offsets are passed to the notice' );
776
777
        $schema->storage->txn_rollback;
778
    };
779
741
    $schema->storage->txn_rollback;
780
    $schema->storage->txn_rollback;
742
};
781
};
743
782
744
- 

Return to bug 29139