Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 2eff7f81

Von Steven Schubiger vor etwa 2 Jahren hinzugefügt

  • ID 2eff7f81d39fa5a9e20bd0a25b09a16e28bfdd65
  • Vorgänger a642ab4b
  • Nachfolger 53b1e8a6

Swiss QR-Bill: qrbill.t: Teste Grundfunktionalität von QrBill.pm

Unterschiede anzeigen:

t/helper/qrbill.t
1
use Test::More tests => 4;
2

  
3
use strict;
4
use constant true => 1;
5

  
6
use lib 't';
7

  
8
use File::Spec;
9
use File::Temp qw(tempdir);
10

  
11
use_ok 'SL::Helper::QrBill';
12

  
13
my $amount = sprintf "%.2f", 1949.75;
14

  
15
my @hrefs = (
16
  { iban => 'CH4431999123000889012' },
17
  { address_type => 'S',
18
    company => 'Max Muster & Söhne',
19
    street => 'Musterstrasse',
20
    street_no => '123',
21
    postalcode => '8000',
22
    city => 'Seldwyla',
23
    countrycode => 'CH' },
24
  { amount => $amount,
25
    currency => 'CHF' },
26
  { address_type => 'K',
27
    name => 'Simon Muster',
28
    address_row1 => 'Musterstrasse 1',
29
    address_row2 => '8000 Seldwyla',
30
    countrycode => 'CH' },
31
  { type => 'QRR',
32
    ref_number => '210000000003139471430009017' },
33
  { unstructured_message => 'Auftrag vom 15.10.2020' },
34
);
35

  
36
eval { SL::Helper::QrBill->new(@hrefs); };
37
ok(!$@, 'new()');
38

  
39
my $tmpdir   = tempdir(CLEANUP => true);
40
my $out_file = File::Spec->catfile($tmpdir, 'out.png');
41

  
42
eval { SL::Helper::QrBill->new(@hrefs)->generate($out_file); };
43
ok(!$@, 'generate()');
44

  
45
ok(-e $out_file && -s _, '$out_file written');

Auch abrufbar als: Unified diff