1use strict;
2use warnings;
3
4our $count;
5BEGIN { $count = 3 }
6use Test::More tests => $count;
7
8use HTML::FormFu;
9use lib 't/lib';
10
11SKIP: {
12    eval "use MyApp::Schema";
13
14    skip 'DBIx::Class needed', $count if $@;
15
16    my $form = HTML::FormFu->new;
17
18    $form->element( { name => 'title' } );
19    $form->element( { name => 'name' } );
20    $form->element( { name => 'age' } );
21
22    my $schema = MyApp::Schema->connect;
23
24    $form->constraints_from_dbic( $schema->resultset('Person') );
25
26    is( @{ $form->get_field('title')->get_constraints }, 1 );
27    is( @{ $form->get_field('name')->get_constraints },  1 );
28    is( @{ $form->get_field('age')->get_constraints },   2 );
29
30}
31