Debian Codegraph @

t/field_setup/input_param.t

raw
1 use strict;
2 use warnings;
3 use Test::More;
4
5 {
6 package Test::HTML::FormHandler::InputParam;
7 use HTML::FormHandler::Moose;
8 extends 'HTML::FormHandler';
9
10 has_field 'base_name' => (
11 type => 'Text',
12 required => 1,
13 input_param=> 'input_name',
14 );
15 }
16
17 my $form1 = Test::HTML::FormHandler::InputParam->new;
18 ok( $form1, 'Created Form' );
19 my %params1 = ( input_name => 'This is a mapped input',);
20 my $result1 = $form1->process(params=>\%params1);
21 ok( $result1, 'got good result' );
22 ok( !$form1->has_errors, 'No errors' );
23 my $form2 = Test::HTML::FormHandler::InputParam->new;
24 ok( $form2, 'Created Form' );
25 my %params2 = ( base_name => 'This is a mapped input' );
26 my $result2 = $form2->process(params=>\%params2);
27 ok( ! $result2, 'got correct failing result' );
28 ok( $form2->has_errors, 'Yes there are errors' );
29
30 done_testing;