File Coverage

blib/lib/Bracket/Form/Register.pm
Criterion Covered Total %
statement 6 6 100.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 8 8 100.0


line stmt bran cond sub pod time code
1              
2             use HTML::FormHandler::Moose;
3 4     4   1653 extends 'HTML::FormHandler::Model::DBIC';
  4         64085  
  4         14  
4             with 'HTML::FormHandler::Render::Table';
5              
6             has '+item_class' => ( default => 'Player' );
7              
8             has_field 'first_name' => ( type => 'Text', required => 1 );
9             has_field 'last_name' => ( type => 'Text' );
10             has_field 'email' => (
11             type => 'Email',
12             required => 1,
13             unique => 1,
14             );
15             has_field 'password' => ( type => 'Password', required => 1 );
16             has_field 'password_confirm' => ( type => 'PasswordConf' );
17             has_field 'submit' => ( type => 'Submit', value => 'Register' );
18              
19             has '+unique_messages' =>
20             ( default => sub { { player_email => 'Email address already registered' } } );
21              
22             # Insert basic role record into player_roles table on registration
23             after 'update_model' => sub {
24             my $self = shift;
25            
26             $self->item->update_or_create_related('player_roles', { role => 2});
27             };
28              
29             no HTML::FormHandler::Moose;
30 4     4   693750 __PACKAGE__->meta->make_immutable;
  4         10  
  4         24  
31              
32             1