Revision 29666977
Von Andreas Rudin vor 12 Monaten hinzugefügt
t/year_end/year_end.t | ||
---|---|---|
my $cb_date = DateTime->new(year => $year, month => 12, day => 31);
|
||
my $ob_date = $cb_date->clone->add(days => 1);
|
||
|
||
SL::Controller::YearEndTransactions::_year_end_bookings( start_date => $start_date,
|
||
cb_date => $cb_date,
|
||
);
|
||
my $controller = SL::Controller::YearEndTransactions->new();
|
||
$controller->_year_end_bookings( start_date => $start_date,
|
||
cb_date => $cb_date,
|
||
);
|
||
|
||
is(SL::DB::Manager::AccTransaction->get_all_count(where => [ cb_transaction => 1 ]), 14, 'acc_trans cb_transactions created ok');
|
||
is(SL::DB::Manager::AccTransaction->get_all_count(where => [ ob_transaction => 1 ]), 10, 'acc_trans ob_transactions created ok');
|
||
... | ... | |
# second and third run should be no-ops, at least while no further bookings where
|
||
# made
|
||
|
||
SL::Controller::YearEndTransactions::_year_end_bookings( start_date => $start_date,
|
||
cb_date => $cb_date,
|
||
);
|
||
$controller->_year_end_bookings( start_date => $start_date,
|
||
cb_date => $cb_date,
|
||
);
|
||
|
||
is(SL::DB::Manager::AccTransaction->get_all_count(where => [ cb_transaction => 1 ]), 14, 'acc_trans cb_transactions created ok');
|
||
is(SL::DB::Manager::AccTransaction->get_all_count(where => [ ob_transaction => 1 ]), 10, 'acc_trans ob_transactions created ok');
|
||
... | ... | |
gl_booking(10, $booking_date, 'foo', 'bar', $cash, $bank, 0, 0);
|
||
gl_booking(5, $booking_date, 'foo', 'bar', $betriebsbedarf, $cash, 0, 0);
|
||
|
||
SL::Controller::YearEndTransactions::_year_end_bookings( start_date => $start_date,
|
||
cb_date => $cb_date,
|
||
);
|
||
$controller->_year_end_bookings( start_date => $start_date,
|
||
cb_date => $cb_date,
|
||
);
|
||
|
||
is(SL::DB::Manager::AccTransaction->get_all_count(where => [ cb_transaction => 1 ]), 23, 'acc_trans cb_transactions created ok');
|
||
is(SL::DB::Manager::AccTransaction->get_all_count(where => [ ob_transaction => 1 ]), 16, 'acc_trans ob_transactions created ok');
|
Auch abrufbar als: Unified diff
Test für SL/Controller/YearEndTransactions.pm angepasst