X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=t%2Fhelper%2Fattr.t;h=5d6238ed9584c066c1b7f72db5a442dad660913c;hb=8ded2eedc25dbec2e489f81f6355fc5f0998f46d;hp=cad0a0f9cf6b42eba79131fa4ae8abbae0393433;hpb=1889a90c69d49efe8cad029c7a3b7baf6b4d0c6e;p=kivitendo-erp.git diff --git a/t/helper/attr.t b/t/helper/attr.t index cad0a0f9c..5d6238ed9 100644 --- a/t/helper/attr.t +++ b/t/helper/attr.t @@ -1,18 +1,20 @@ -use Test::More tests => 29; +use Test::More tests => 32; + +use lib 't'; use DateTime; +use_ok 'Support::TestSetup'; use_ok 'SL::DB::Part'; use_ok 'SL::DB::Order'; use_ok 'SL::DB::Invoice'; -use_ok 'SL::Dispatcher'; -SL::Dispatcher::pre_startup_setup(); +Support::TestSetup::login(); -$::form = Form->new; +{ $::myconfig{numberformat} = '1.000,00'; $::myconfig{dateformat} = 'dd.mm.yyyy'; -$::locale = Locale->new('de'); +} my $p = new_ok 'SL::DB::Part'; is($p->sellprice_as_number('2,30'), '2,30'); @@ -31,14 +33,14 @@ is($o->reqdate_as_date, '11.12.2007'); $o->reqdate(DateTime->new(year => 2010, month => 4, day => 12)); is($o->reqdate_as_date, '12.04.2010'); -is($o->marge_percent_as_percent('40'), '40'); +is($o->marge_percent_as_percent('40'), '40,00'); is($o->marge_percent, 0.40); -is($o->marge_percent_as_percent, '40'); +is($o->marge_percent_as_percent, '40,00'); is($o->marge_percent_as_percent('22,4'), '22,40'); is($o->marge_percent, 0.224); -is($o->marge_percent_as_percent, '22'); +is($o->marge_percent_as_percent, '22,40'); is($o->marge_percent(0.231), 0.231); -is($o->marge_percent_as_percent, '23'); +is($o->marge_percent_as_percent, '23,10'); # overloaded attr: invoice taxamount my $i = new_ok 'SL::DB::Invoice'; @@ -48,3 +50,13 @@ $i->amount(12); $i->netamount(10.34); is($i->taxamount_as_number, '1,66'); +$o->closed(1); +is $o->closed_as_bool_yn, 'Ja', 'bool 1'; +$o->closed(0); +is $o->closed_as_bool_yn, 'Nein', 'bool 2'; + +# undef test: this only works for columns without default, rose will set +# defaults according to the database +$i->taxincluded(undef); +is $i->taxincluded_as_bool_yn, '', 'bool 3'; +