File: missing.t

package info (click to toggle)
libhtml-formhandler-perl 0.40057-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,320 kB
  • ctags: 685
  • sloc: perl: 8,849; makefile: 2
file content (25 lines) | stat: -rw-r--r-- 657 bytes parent folder | download | duplicates (5)
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
use strict;
use warnings;
use Test::More;

{

    package MyApp::Form::Test;
    use HTML::FormHandler::Moose;
    extends 'HTML::FormHandler';

    has '+name' => ( default => 'test_form' );

    has_field 'foo' => ( required => 1 );
    has_field 'bar' => ( required => 1 );;
}

my $form = MyApp::Form::Test->new;
$form->process( params => {} );
ok( ! $form->field('bar')->missing, 'bar is not missing' );
ok( ! $form->field('foo')->missing, 'foo is not missing' );
$form->process( params => { foo => 'my_foo', bar => '' } );
ok( $form->field('bar')->missing, 'bar is missing' );
ok( ! $form->field('foo')->missing, 'foo is not missing' );

done_testing;