X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/ef5b4b39f9ddcf2da56dc0e781f1c0c57c7e9744..c60cb1f08f:/t/datev/datev_format_2018.t diff --git a/t/datev/datev_format_2018.t b/t/datev/datev_format_2018.t index aeb9979ed..3660b28fd 100644 --- a/t/datev/datev_format_2018.t +++ b/t/datev/datev_format_2018.t @@ -68,20 +68,31 @@ $datev1->generate_datev_lines; # check conversion to csv $datev1->from($startdate); $datev1->to($enddate); -eval { - $datev1->csv_buchungsexport(); - 1; }; -like($@, qr/^Not a valid value: '' for 'belegfeld1' with .*/, "wrong encoding"); +$datev1->csv_buchungsexport(); +my @warnings = $datev1->warnings; +is($warnings[0]->[0]->{untranslated}, + 'Wrong field value \'#1\' for field \'#2\' for the transaction with amount \'#3\'', 'wrong_encoding'); -# redefine invnumber, but still broken + +# redefine invnumber, we have mixed encodings, should still generate a warning $invoice->invnumber('ݗݘݰݶmuh'); $invoice->save(); -$datev1->generate_datev_data; -$datev1->generate_datev_lines; -eval { - $datev1->csv_buchungsexport(); - 1; }; -like($@, qr/^Not a valid value: '' for 'belegfeld1' with amount/, "mixed encoding"); + +my $datev3 = SL::DATEV->new( + dbh => $dbh, + trans_id => $invoice->id, +); + +$datev3->from($startdate); +$datev3->to($enddate); +$datev3->generate_datev_data; +$datev3->generate_datev_lines; +$datev3->csv_buchungsexport; +@warnings = []; +@warnings = $datev3->warnings; +is($warnings[0]->[0]->{untranslated}, + 'Wrong field value \'#1\' for field \'#2\' for the transaction with amount \'#3\'', 'mixed_wrong_encoding'); + # create one haben buchung with GLTransaction today @@ -169,6 +180,7 @@ clear_up(); sub clear_up { SL::DB::Manager::AccTransaction->delete_all( all => 1); + SL::DB::Manager::GLTransaction->delete_all( all => 1); SL::DB::Manager::InvoiceItem->delete_all( all => 1); SL::DB::Manager::Invoice->delete_all( all => 1); SL::DB::Manager::Customer->delete_all( all => 1);