1 |
1 |
use strict;
|
2 |
2 |
use Test::More;
|
3 |
|
use Test::Deep qw(cmp_bag);
|
|
3 |
use Test::Deep qw(cmp_deeply cmp_bag);
|
4 |
4 |
|
5 |
5 |
use lib 't';
|
6 |
6 |
use utf8;
|
... | ... | |
64 |
64 |
$datev1->generate_datev_data;
|
65 |
65 |
|
66 |
66 |
my @data_datev = sort { $a->{umsatz} <=> $b->{umsatz} } @{ $datev1->generate_datev_lines() };
|
67 |
|
cmp_bag \@data_datev, [
|
|
67 |
cmp_deeply \@data_datev, [
|
68 |
68 |
{
|
69 |
69 |
'belegfeld1' => "\x{de} sales \x{a5}& inv\x{f6}ice",
|
70 |
70 |
'buchungstext' => 'Testcustomer',
|
... | ... | |
108 |
108 |
|
109 |
109 |
$datev1->use_pk(1);
|
110 |
110 |
$datev1->generate_datev_data;
|
|
111 |
# TODO for cmp_deeply we need to sort the incoming data structure (see below)
|
111 |
112 |
cmp_bag $datev1->generate_datev_lines, [
|
112 |
113 |
{
|
113 |
114 |
'belegfeld1' => "\x{de} sales \x{a5}& inv\x{f6}ice",
|
... | ... | |
172 |
173 |
my @data_csv = splice @{ $datev_ref }, 2, 5;
|
173 |
174 |
@data_csv = sort { $a->[0] cmp $b->[0] } @data_csv;
|
174 |
175 |
|
175 |
|
cmp_bag($data_csv[1], [ 535, 'S', 'EUR', '', '', '', '1400', '8300', '', '0101', "\x{de} sales \x{a5}& i",
|
|
176 |
cmp_deeply($data_csv[1], [ 535, 'S', 'EUR', '', '', '', '1400', '8300', '', '0101', "\x{de} sales \x{a5}& i",
|
176 |
177 |
'', '', '', '', '', '', '', '', '', '', '',
|
177 |
178 |
'', '', '', '', '', '', '', '', '', '', '', '', '',
|
178 |
|
'', 'Crowd-Fu', 'Kostenst', '', '', '', '', '', '', '', '',
|
|
179 |
'', 'Kostenst', 'Crowd-Fu', '', '', '', '', '', '', '', '',
|
179 |
180 |
'', '', '', '', '', '', '', '', '', '', '', '', '',
|
180 |
181 |
'', '', '', '', '', '', '', '', '', '', '', '', '',
|
181 |
182 |
'', '', '', '', '', '', '', '', '', '', '', '', '',
|
... | ... | |
184 |
185 |
'', '', '', '', '' ]
|
185 |
186 |
);
|
186 |
187 |
|
187 |
|
cmp_bag($data_csv[0], [ '249,9', 'S', 'EUR', '', '', '', '1400', '8400', '', '0101', "\x{de} sales \x{a5}& i",
|
|
188 |
cmp_deeply($data_csv[0], [ '249,9', 'S', 'EUR', '', '', '', '1400', '8400', '', '0101', "\x{de} sales \x{a5}& i",
|
188 |
189 |
'', '', '', '', '', '', '', '', '', '', '',
|
189 |
190 |
'', '', '', '', '', '', '', '', '', '', '', '', '',
|
190 |
|
'', 'Crowd-Fu', 'Kostenst', '', '', '', '', '', '', '', '',
|
|
191 |
'', 'Kostenst', 'Crowd-Fu', '', '', '', '', '', '', '', '',
|
191 |
192 |
'', '', '', '', '', '', '', '', '', '', '', '', '',
|
192 |
193 |
'', '', '', '', '', '', '', '', '', '', '', '', '',
|
193 |
194 |
'', '', '', '', '', '', '', '', '', '', '', '', '',
|
... | ... | |
195 |
196 |
'', '', '', '', '', '', '', '', '', '', '', '', '',
|
196 |
197 |
'', '', '', '', '' ]
|
197 |
198 |
);
|
198 |
|
cmp_bag($data_csv[2], [ '784,9', 'S', 'EUR', '', '', '', '1200', '1400', '', '0501', "\x{de} sales \x{a5}& i",
|
|
199 |
cmp_deeply($data_csv[2], [ '784,9', 'S', 'EUR', '', '', '', '1200', '1400', '', '0501', "\x{de} sales \x{a5}& i",
|
199 |
200 |
'', '', '', '', '', '', '', '', '', '', '',
|
200 |
201 |
'', '', '', '', '', '', '', '', '', '', '', '', '',
|
201 |
|
'', 'Crowd-Fu', 'Kostenst', '', '', '', '', '', '', '', '',
|
|
202 |
'', 'Kostenst', 'Crowd-Fu', '', '', '', '', '', '', '', '',
|
202 |
203 |
'', '', '', '', '', '', '', '', '', '', '', '', '',
|
203 |
204 |
'', '', '', '', '', '', '', '', '', '', '', '', '',
|
204 |
205 |
'', '', '', '', '', '', '', '', '', '', '', '', '',
|
... | ... | |
254 |
255 |
);
|
255 |
256 |
|
256 |
257 |
$datev1->generate_datev_data;
|
257 |
|
cmp_bag $datev1->generate_datev_lines, [
|
|
258 |
cmp_deeply $datev1->generate_datev_lines, [
|
258 |
259 |
{
|
259 |
260 |
'belegfeld1' => 'ap1',
|
260 |
261 |
'buchungstext' => 'Testvendor',
|
... | ... | |
282 |
283 |
], "trans_id datev check purchase_invoice ok";
|
283 |
284 |
$datev1->use_pk(1);
|
284 |
285 |
$datev1->generate_datev_data;
|
285 |
|
cmp_bag $datev1->generate_datev_lines, [
|
|
286 |
cmp_deeply $datev1->generate_datev_lines, [
|
286 |
287 |
{
|
287 |
288 |
'belegfeld1' => 'ap1',
|
288 |
289 |
'buchungstext' => 'Testvendor',
|
... | ... | |
326 |
327 |
|
327 |
328 |
$::form->{gldatefrom} = DateTime->new(year => 2017, month => 5, day => 1)->to_kivitendo;
|
328 |
329 |
$datev->generate_datev_data(from_to => $datev->fromto);
|
329 |
|
cmp_bag $datev->generate_datev_lines, [], "no bookings for January made after May 1st: ok";
|
|
330 |
cmp_deeply $datev->generate_datev_lines, [], "no bookings for January made after May 1st: ok";
|
330 |
331 |
|
331 |
332 |
done_testing();
|
332 |
333 |
# clear_up();
|
DATEV: Tests strikter gemacht s/cmp_bag/cmp_deeply/gc