1 use Test::More tests => 29;
6 use_ok 'SL::DB::Order';
7 use_ok 'SL::DB::Invoice';
8 use_ok 'SL::Dispatcher';
12 $::dispatcher = SL::Dispatcher->new;
13 $::dispatcher->pre_startup_setup;
16 $::myconfig{numberformat} = '1.000,00';
17 $::myconfig{dateformat} = 'dd.mm.yyyy';
18 $::locale = Locale->new('de');
21 my $p = new_ok 'SL::DB::Part';
22 is($p->sellprice_as_number('2,30'), '2,30');
23 is($p->sellprice, 2.30);
24 is($p->sellprice_as_number, '2,30');
25 is($p->sellprice_as_number('2,3442'), '2,3442');
26 is($p->sellprice, 2.3442);
27 is($p->sellprice_as_number, '2,3442');
29 my $o = new_ok 'SL::DB::Order';
30 is($o->reqdate_as_date('11.12.2007'), '11.12.2007');
31 is($o->reqdate->year, 2007);
32 is($o->reqdate->month, 12);
33 is($o->reqdate->day, 11);
34 is($o->reqdate_as_date, '11.12.2007');
35 $o->reqdate(DateTime->new(year => 2010, month => 4, day => 12));
36 is($o->reqdate_as_date, '12.04.2010');
38 is($o->marge_percent_as_percent('40'), '40,00');
39 is($o->marge_percent, 0.40);
40 is($o->marge_percent_as_percent, '40,00');
41 is($o->marge_percent_as_percent('22,4'), '22,40');
42 is($o->marge_percent, 0.224);
43 is($o->marge_percent_as_percent, '22,40');
44 is($o->marge_percent(0.231), 0.231);
45 is($o->marge_percent_as_percent, '23,10');
47 # overloaded attr: invoice taxamount
48 my $i = new_ok 'SL::DB::Invoice';
50 is($i->taxamount_as_number, '0,00');
53 is($i->taxamount_as_number, '1,66');