File: array.t

package info (click to toggle)
libhtml-formfu-perl 2.07000-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,396 kB
  • sloc: perl: 12,777; makefile: 9; sql: 5
file content (28 lines) | stat: -rw-r--r-- 582 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
use strict;
use warnings;

use Test::More tests => 8;

use HTML::FormFu;

my $form = HTML::FormFu->new;

my $field = $form->element('Text')->name('foo');

$field->inflator('DateTime')->parser( { strptime => '%d/%m/%Y' } );

$form->process( { foo => [ '31/12/2006', '01/01/2007' ], } );

my $value = $form->param_array('foo');

isa_ok( $value->[0], 'DateTime' );

is( $value->[0]->day,   31 );
is( $value->[0]->month, 12 );
is( $value->[0]->year,  2006 );

isa_ok( $value->[1], 'DateTime' );

is( $value->[1]->day,   1 );
is( $value->[1]->month, 1 );
is( $value->[1]->year,  2007 );