Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 18a2ca33

Von Jan Büren vor etwa 7 Jahren hinzugefügt

  • ID 18a2ca336c2e4c87bd1d6fe55bc9d83e177584a5
  • Vorgänger 7130c4c1
  • Nachfolger 7bee3eca

Testfälle für neue API von DATEV angepasst

Unterschiede anzeigen:

t/datev/datev_format_2018.t
68 68
# check conversion to csv
69 69
$datev1->from($startdate);
70 70
$datev1->to($enddate);
71
my ($datev_ref, $warnings_ref, $die_message);
71
my ($datev_csv, $die_message);
72 72
eval {
73
  ($datev_ref, $warnings_ref) = SL::DATEV::CSV->new(datev_lines  => $datev1->generate_datev_lines,
74
                                                     from         => $startdate,
75
                                                     to           => $enddate,
76
                                                     locked       => $datev1->locked,
77
                                                    );
73
  $datev_csv = SL::DATEV::CSV->new(datev_lines  => $datev1->generate_datev_lines,
74
                                   from         => $startdate,
75
                                   to           => $enddate,
76
                                   locked       => $datev1->locked,
77
                                  );
78
  my $lines_aref = $datev_csv->lines; # dies only if we assign (do stuff with the data)
78 79
  1;
79 80
} or do {
80 81
  $die_message = $@;
81 82
};
82

  
83 83
ok($die_message =~ m/Falscher Feldwert 'ݗݘݰݶ' für Feld 'belegfeld1' bei der Transaktion mit dem Umsatz von/, 'wrong_encoding');
84 84

  
85 85

  
......
95 95
$datev3->to($enddate);
96 96
$datev3->generate_datev_data;
97 97
$datev3->generate_datev_lines;
98
my ($datev_ref2, $warnings_ref2, $die_message2);
98
my ($datev_csv2, $die_message2);
99 99
eval {
100
  ($datev_ref2, $warnings_ref2) = SL::DATEV::CSV->new(datev_lines  => $datev3->generate_datev_lines,
101
                                                       from         => $startdate,
102
                                                       to           => $enddate,
103
                                                       locked       => $datev3->locked,
104
                                                      );
100
  $datev_csv2 = SL::DATEV::CSV->new(datev_lines  => $datev3->generate_datev_lines,
101
                                    from         => $startdate,
102
                                    to           => $enddate,
103
                                    locked       => $datev3->locked,
104
                                   );
105
my $lines_aref = $datev_csv2->lines; # dies only if we assign (do stuff with the data)
106

  
105 107
  1;
106 108
} or do {
107 109
  $die_message2 = $@;
......
172 174
$datev2->generate_datev_data;
173 175
$datev2->generate_datev_lines;
174 176

  
175
my ($datev_ref3, $warnings_ref3) = SL::DATEV::CSV->new(datev_lines  => $datev2->generate_datev_lines,
176
                                                       from         => $startdate,
177
                                                       to           => $enddate,
178
                                                       locked       => $datev2->locked,
179
                                                      );
177
my $datev_csv3  = SL::DATEV::CSV->new(datev_lines  => $datev2->generate_datev_lines,
178
                                      from         => $startdate,
179
                                      to           => $enddate,
180
                                      locked       => $datev2->locked,
181
                                     );
180 182

  
181
my @data_csv = splice @{ $datev_ref3 }, 2, 5;
182
@data_csv    = sort { $a->[0] cmp $b->[0] } @data_csv;
183
my @data_csv = $datev_csv3->lines;
184
@data_csv    = sort { $a->[0] cmp $b->[0] } @{ $datev_csv3->lines };
183 185
cmp_deeply($data_csv[0], [ 100, 'H', 'EUR', '', '', '', '4660', '1000', 9, '1703', 'Reise März 2',
184 186
                     '', '', '', '', '', '', '', '', '', '', '',
185 187
                     '', '', '', '', '', '', '', '', '', '', '', '', '',
......
192 194
                     '', '', '', '', '' ]
193 195
       );
194 196

  
197
# TODO warnings are not yet tested
198
# currently most of the valid_checks are senseless because of
199
# the strict input_checks before. Maybe something like encoding mismatch of invnumber,
200
# can be altered to just a warning (not a mandantory field!)
201

  
195 202
done_testing();
196 203
clear_up();
197 204

  
t/datev/invoices.t
160 160
$datev1->generate_datev_data;
161 161

  
162 162

  
163
my ($datev_ref, $w_ref) = SL::DATEV::CSV->new(datev_lines  => $datev1->generate_datev_lines,
164
                                              from         => $startdate,
165
                                              to           => $enddate,
166
                                              locked       => $datev1->locked,
163
my $datev_csv = SL::DATEV::CSV->new(datev_lines  => $datev1->generate_datev_lines,
164
                                    from         => $startdate,
165
                                    to           => $enddate,
166
                                    locked       => $datev1->locked,
167 167
                                   );
168
# warnings should be undef -> no array elements at all
169
is(scalar @{ $w_ref }, 0);
168
$datev_csv->lines;
169

  
170 170

  
171
# splice away the header, because sort won't do
172 171
# we need sort, because pay_invoice is not acc_trans_id order safe
173
my @data_csv = splice @{ $datev_ref }, 2, 5;
174
@data_csv    = sort { $a->[0] cmp $b->[0] } @data_csv;
172
my @data_csv    = sort { $a->[0] cmp $b->[0] } @{ $datev_csv->lines };
173
# warnings should be undef -> no array elements at all
174
is(scalar @{ $datev_csv->warnings }, 0);
175

  
175 176

  
176 177
cmp_deeply($data_csv[1], [ 535, 'S', 'EUR', '', '', '', '1400', '8300', '', '0101', "\x{de} sales \x{a5}& i",
177 178
                     '', '', '', '', '', '', '', '', '', '', '',

Auch abrufbar als: Unified diff