From: Sven Schöling Date: Thu, 30 Aug 2012 13:09:44 +0000 (+0200) Subject: t/form/format_amount: boilerplate entfernt, und use once warnung unterdrückt X-Git-Tag: release-3.0.0beta1~262^2~1 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=72858259ef9bad485f7b37ee97f6bc799d433dfd;p=kivitendo-erp.git t/form/format_amount: boilerplate entfernt, und use once warnung unterdrückt --- diff --git a/t/form/format_amount.t b/t/form/format_amount.t index 41a25c2d7..a88238ee8 100644 --- a/t/form/format_amount.t +++ b/t/form/format_amount.t @@ -2,42 +2,28 @@ use strict; use Test::More; use lib 't'; +use Support::TestSetup; -use_ok('SL::Form'); -require_ok('SL::Form'); - - -package LxDebugMock; -sub enter_sub {}; -sub leave_sub {}; - -$main::lxdebug = bless({}, 'LxDebugMock'); - -package main; - - -my $form = Form->new(); - +Support::TestSetup::login(); my $config = {}; - $config->{numberformat} = '1.000,00'; -is($form->format_amount($config, '1e1', 2), '10,00', 'format 1e1 (numberformat: 1.000,00)'); -is($form->format_amount($config, 1000, 2), '1.000,00', 'format 1000 (numberformat: 1.000,00)'); -is($form->format_amount($config, 1000.1234, 2), '1.000,12', 'format 1000.1234 (numberformat: 1.000,00)'); -is($form->format_amount($config, 1000000000.1234, 2), '1.000.000.000,12', 'format 1000000000.1234 (numberformat: 1.000,00)'); -is($form->format_amount($config, -1000000000.1234, 2), '-1.000.000.000,12', 'format -1000000000.1234 (numberformat: 1.000,00)'); +is($::form->format_amount($config, '1e1', 2), '10,00', 'format 1e1 (numberformat: 1.000,00)'); +is($::form->format_amount($config, 1000, 2), '1.000,00', 'format 1000 (numberformat: 1.000,00)'); +is($::form->format_amount($config, 1000.1234, 2), '1.000,12', 'format 1000.1234 (numberformat: 1.000,00)'); +is($::form->format_amount($config, 1000000000.1234, 2), '1.000.000.000,12', 'format 1000000000.1234 (numberformat: 1.000,00)'); +is($::form->format_amount($config, -1000000000.1234, 2), '-1.000.000.000,12', 'format -1000000000.1234 (numberformat: 1.000,00)'); $config->{numberformat} = '1,000.00'; -is($form->format_amount($config, '1e1', 2), '10.00', 'format 1e1 (numberformat: 1,000.00)'); -is($form->format_amount($config, 1000, 2), '1,000.00', 'format 1000 (numberformat: 1,000.00)'); -is($form->format_amount($config, 1000.1234, 2), '1,000.12', 'format 1000.1234 (numberformat: 1,000.00)'); -is($form->format_amount($config, 1000000000.1234, 2), '1,000,000,000.12', 'format 1000000000.1234 (numberformat: 1,000.00)'); -is($form->format_amount($config, -1000000000.1234, 2), '-1,000,000,000.12', 'format -1000000000.1234 (numberformat: 1,000.00)'); +is($::form->format_amount($config, '1e1', 2), '10.00', 'format 1e1 (numberformat: 1,000.00)'); +is($::form->format_amount($config, 1000, 2), '1,000.00', 'format 1000 (numberformat: 1,000.00)'); +is($::form->format_amount($config, 1000.1234, 2), '1,000.12', 'format 1000.1234 (numberformat: 1,000.00)'); +is($::form->format_amount($config, 1000000000.1234, 2), '1,000,000,000.12', 'format 1000000000.1234 (numberformat: 1,000.00)'); +is($::form->format_amount($config, -1000000000.1234, 2), '-1,000,000,000.12', 'format -1000000000.1234 (numberformat: 1,000.00)'); done_testing;