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

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

Return to bug 29139