File: array.t

package info (click to toggle)
libhtml-formfu-perl 0.07002-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 3,928 kB
  • ctags: 989
  • sloc: perl: 12,036; makefile: 9; sql: 5
file content (30 lines) | stat: -rw-r--r-- 580 bytes parent folder | download | duplicates (2)
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
29
30
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 );