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

(-)a/t/db_dependent/Koha/Account.t (-7 / +7 lines)
Lines 90-97 subtest 'add_credit() tests' => sub { Link Here
90
    $schema->storage->txn_begin;
90
    $schema->storage->txn_begin;
91
91
92
    # delete logs and statistics
92
    # delete logs and statistics
93
    $schema->resultset('ActionLog')->search()->delete();
93
    my $action_logs = $schema->resultset('ActionLog')->search()->count;
94
    $schema->resultset('Statistic')->search()->delete();
94
    my $statistics = $schema->resultset('Statistic')->search()->count;
95
95
96
    my $patron  = $builder->build_object( { class => 'Koha::Patrons' } );
96
    my $patron  = $builder->build_object( { class => 'Koha::Patrons' } );
97
    my $account = Koha::Account->new( { patron_id => $patron->borrowernumber } );
97
    my $account = Koha::Account->new( { patron_id => $patron->borrowernumber } );
Lines 106-118 subtest 'add_credit() tests' => sub { Link Here
106
            description => 'Payment of 25',
106
            description => 'Payment of 25',
107
            library_id  => $patron->branchcode,
107
            library_id  => $patron->branchcode,
108
            note        => 'not really important',
108
            note        => 'not really important',
109
            type        => 'payment',
109
            user_id     => $patron->id
110
            user_id     => $patron->id
110
        }
111
        }
111
    );
112
    );
112
113
113
    is( $account->balance, -25, 'Patron has a balance of -25' );
114
    is( $account->balance, -25, 'Patron has a balance of -25' );
114
    is( $schema->resultset('ActionLog')->count(), 0, 'No log was added' );
115
    is( $schema->resultset('ActionLog')->count(), $action_logs + 0, 'No log was added' );
115
    is( $schema->resultset('Statistic')->count(), 1, 'Action added to statistics' );
116
    is( $schema->resultset('Statistic')->count(), $statistics + 1, 'Action added to statistics' );
116
    is( $line_1->accounttype, $Koha::Account::account_type->{'payment'}, 'Account type is correctly set' );
117
    is( $line_1->accounttype, $Koha::Account::account_type->{'payment'}, 'Account type is correctly set' );
117
118
118
    # Enable logs
119
    # Enable logs
Lines 130-137 subtest 'add_credit() tests' => sub { Link Here
130
    );
131
    );
131
132
132
    is( $account->balance, -62, 'Patron has a balance of -25' );
133
    is( $account->balance, -62, 'Patron has a balance of -25' );
133
    is( $schema->resultset('ActionLog')->count(), 1, 'Log was added' );
134
    is( $schema->resultset('ActionLog')->count(), $action_logs + 1, 'Log was added' );
134
    is( $schema->resultset('Statistic')->count(), 2, 'Action added to statistics' );
135
    is( $schema->resultset('Statistic')->count(), $statistics + 2, 'Action added to statistics' );
135
    is( $line_2->accounttype, $Koha::Account::account_type->{'payment'} . $sip_code, 'Account type is correctly set' );
136
    is( $line_2->accounttype, $Koha::Account::account_type->{'payment'} . $sip_code, 'Account type is correctly set' );
136
137
137
    # offsets have the credit_id set to accountlines_id, and debit_id is undef
138
    # offsets have the credit_id set to accountlines_id, and debit_id is undef
138
- 

Return to bug 20978