Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision c616c909

Von Sven Schöling vor etwa 14 Jahren hinzugefügt

  • ID c616c9090b5e839938707d1ca3bf70b2de46b858
  • Vorgänger 14a3e368
  • Nachfolger 2914c199

AttrHelper Tests.

Unterschiede anzeigen:

t/helper/attr.t
1
use Test::More tests => 25;
2

  
3
use DateTime;
4

  
5
use_ok 'SL::DB::Part';
6
use_ok 'SL::DB::Order';
7
use_ok 'SL::Dispatcher';
8

  
9
SL::Dispatcher::pre_startup_setup();
10

  
11
$::form = Form->new;
12
$::myconfig{numberformat} = '1.000,00';
13
$::myconfig{dateformat} = 'dd.mm.yyyy';
14
$::locale = Locale->new('de');
15

  
16
my $p = new_ok 'SL::DB::Part';
17
is($p->sellprice_as_number('2,30'), '2,30');
18
is($p->sellprice, 2.30);
19
is($p->sellprice_as_number, '2,30');
20
is($p->sellprice_as_number('2,3442'), '2,3442');
21
is($p->sellprice, 2.3442);
22
is($p->sellprice_as_number, '2,3442');
23

  
24
my $o = new_ok 'SL::DB::Order';
25
is($o->reqdate_as_date('11.12.2007'), '11.12.2007');
26
is($o->reqdate->year, 2007);
27
is($o->reqdate->month, 12);
28
is($o->reqdate->day, 11);
29
is($o->reqdate_as_date, '11.12.2007');
30
$o->reqdate(DateTime->new(year => 2010, month => 4, day => 12));
31
is($o->reqdate_as_date, '12.04.2010');
32

  
33
is($o->marge_percent_as_percent('40'), '40,00');
34
is($o->marge_percent, 0.40);
35
is($o->marge_percent_as_percent, '40,00');
36
is($o->marge_percent_as_percent('22,4'), '22,40');
37
is($o->marge_percent, 0.224);
38
is($o->marge_percent_as_percent, '22,40');
39
is($o->marge_percent(0.231), 0.231);
40
is($o->marge_percent_as_percent, '23,10');

Auch abrufbar als: Unified diff