Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 725b11b9

Von Tamino Steinert vor 5 Monaten hinzugefügt

  • ID 725b11b92aefc64b17efbbdc53ffb60da102f6a5
  • Vorgänger 976b7115
  • Nachfolger e98cf5de

t/b/create_periodic_invoices: Tests für Positionskonfigurationen

Unterschiede anzeigen:

t/background_job/create_periodic_invoices.t
14 14

  
15 15
package main;
16 16

  
17
use Test::More tests => 64;
17
use Test::More tests => 78;
18 18

  
19 19
use lib 't';
20 20
use strict;
......
251 251
create_invoices(periodic_invoices_config => { periodicity => 'y', order_value_periodicity => '5', start_date => DateTime->from_kivitendo('01.01.2009') });
252 252
are_invoices 'p=y ovp=5',[ '01.01.2009', 66.67 ], [ '01.01.2010', 66.67 ], [ '01.01.2011', 66.67 ], [ '01.01.2012', 66.67 ], [ '01.01.2013', 66.65 ], [ '01.01.2014', 66.67 ];
253 253

  
254
create_invoices(
255
  periodic_invoices_config => {
256
    periodicity => 'm',
257
    order_value_periodicity => 'p',
258
    start_date => DateTime->from_kivitendo('01.01.2013'),
259
    end_date => DateTime->from_kivitendo('31.01.2013'),
260
    extend_automatically_by => 1,
261
  },
262
  orderitem => {
263
    periodic_invoice_items_config => {
264
      periodicity => 'y',
265
    }
266
  }
267
);
268
are_invoices 'p=m ovp=p i_p=y',[ '01.01.2013', 333.33 ], [ '01.01.2014', 333.33 ];
269

  
270
create_invoices(
271
  periodic_invoices_config => {
272
    periodicity => 'm',
273
    order_value_periodicity => 'p',
274
    start_date => DateTime->from_kivitendo('01.01.2013'),
275
    end_date => DateTime->from_kivitendo('31.01.2013'),
276
    extend_automatically_by => 1,
277
  },
278
  orderitem => {
279
    periodic_invoice_items_config => {
280
      periodicity => 'y',
281
      start_date => DateTime->from_kivitendo('01.03.2013'),
282
    }
283
  }
284
);
285
are_invoices 'p=m ovp=p i_p=y i_start_date',[ '01.03.2013', 333.33 ], [ '01.03.2014', 333.33 ];
286

  
287
create_invoices(
288
  periodic_invoices_config => {
289
    periodicity => 'y',
290
    order_value_periodicity => 'p',
291
    start_date => DateTime->from_kivitendo('01.01.2012'),
292
    end_date => DateTime->from_kivitendo('31.12.2012'),
293
    extend_automatically_by => 12,
294
  },
295
  orderitem => {
296
    periodic_invoice_items_config => {
297
      periodicity => 'm',
298
      start_date => DateTime->from_kivitendo('01.03.2012'),
299
    }
300
  }
301
);
302
are_invoices 'p=y ovp=p i_p=m i_start_date', [ '01.01.2012', 3333.30 ], [ '01.01.2013', 3999.96 ], [ '01.01.2014', 3999.96];
303

  
304
create_invoices(
305
  periodic_invoices_config => {
306
    periodicity => 'y',
307
    order_value_periodicity => 'p',
308
    start_date => DateTime->from_kivitendo('01.01.2012'),
309
    end_date => DateTime->from_kivitendo('31.12.2012'),
310
    extend_automatically_by => 12,
311
  },
312
  orderitem => {
313
    periodic_invoice_items_config => {
314
      periodicity => 'm',
315
      start_date  => DateTime->from_kivitendo('01.03.2012'),
316
      end_date    => DateTime->from_kivitendo('31.10.2013'),
317
    }
318
  }
319
);
320
are_invoices 'p=y ovp=p i_p=m i_start_date i_end_date',[ '01.01.2012', 3333.30 ], [ '01.01.2013', 3333.30];
321

  
322
create_invoices(
323
  periodic_invoices_config => {
324
    periodicity => 'y',
325
    order_value_periodicity => 'p',
326
    start_date => DateTime->from_kivitendo('01.01.2012'),
327
    end_date => DateTime->from_kivitendo('31.12.2012'),
328
    extend_automatically_by => 12,
329
  },
330
  orderitem => {
331
    periodic_invoice_items_config => {
332
      periodicity => 'm',
333
      start_date  => DateTime->from_kivitendo('01.03.2012'),
334
      end_date    => DateTime->from_kivitendo('01.02.2012'),
335
    }
336
  }
337
);
338
are_invoices 'p=y ovp=p i_p=m i_start_date after i_end_date';
339

  
340
create_invoices(
341
  periodic_invoices_config => {
342
    periodicity => 'm',
343
    order_value_periodicity => 'p',
344
    start_date => DateTime->from_kivitendo('01.01.2013'),
345
    end_date => DateTime->from_kivitendo('31.01.2013'),
346
    extend_automatically_by => 1,
347
  },
348
  orderitem => {
349
    periodic_invoice_items_config => {
350
      periodicity => 'n',
351
    }
352
  }
353
);
354
are_invoices 'p=m ovp=p i_p=n';
355

  
356
create_invoices(
357
  periodic_invoices_config => {
358
    periodicity => 'm',
359
    order_value_periodicity => 'p',
360
    start_date => DateTime->from_kivitendo('01.01.2013'),
361
    end_date => DateTime->from_kivitendo('31.01.2013'),
362
    extend_automatically_by => 1,
363
  },
364
  orderitem => {
365
    periodic_invoice_items_config => {
366
      periodicity => 'o',
367
      start_date => DateTime->from_kivitendo('01.03.2013'),
368
    }
369
  }
370
);
371
are_invoices 'p=m ovp=p i_p=o i_start_date', [ '01.03.2013', 333.33 ];
372

  
254 373
clear_up();
255 374

  
256 375
done_testing();

Auch abrufbar als: Unified diff