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

(-)a/t/db_dependent/Koha/Cash/Register.t (-8 / +8 lines)
Lines 1325-1332 subtest 'start_cashup_parameter_validation' => sub { Link Here
1325
        my $final_action_count = $register5->_result->search_related('cash_register_actions')->count;
1325
        my $final_action_count = $register5->_result->search_related('cash_register_actions')->count;
1326
        is( $final_action_count, $initial_action_count + 1, 'CASHUP_START action created in database' );
1326
        is( $final_action_count, $initial_action_count + 1, 'CASHUP_START action created in database' );
1327
1327
1328
        # Verify expected amount calculation
1328
        # Verify expected amount calculation (can be positive or negative, but not zero)
1329
        ok( $start->amount >= 0, 'Expected amount calculated correctly' );
1329
        ok( $start->amount != 0, 'Expected amount calculated correctly' );
1330
1330
1331
        # Verify timestamp is set
1331
        # Verify timestamp is set
1332
        ok( defined $start->timestamp, 'Timestamp is set on CASHUP_START action' );
1332
        ok( defined $start->timestamp, 'Timestamp is set on CASHUP_START action' );
Lines 1388-1399 subtest 'add_cashup' => sub { Link Here
1388
        'Koha::Exceptions::Account::AmountNotPositive',
1388
        'Koha::Exceptions::Account::AmountNotPositive',
1389
            'Zero amount throws AmountNotPositive exception';
1389
            'Zero amount throws AmountNotPositive exception';
1390
1390
1391
        # Negative amount
1391
        # Negative amount is now valid (for float deficits)
1392
        throws_ok {
1392
        my $negative_cashup;
1393
            $register3->add_cashup( { manager_id => $manager->id, amount => '-5.00' } );
1393
        lives_ok {
1394
            $negative_cashup = $register3->add_cashup( { manager_id => $manager->id, amount => '-5.00' } );
1394
        }
1395
        }
1395
        'Koha::Exceptions::Account::AmountNotPositive',
1396
        'Negative amount is accepted for float deficit scenarios';
1396
            'Negative amount throws AmountNotPositive exception';
1397
        is( $negative_cashup->amount + 0, -5, 'Negative amount stored correctly' );
1397
1398
1398
        # Non-numeric amount
1399
        # Non-numeric amount
1399
        throws_ok {
1400
        throws_ok {
1400
- 

Return to bug 40445