Galileo/User.pm

filter: Statementstmt 100% 20 / 20 Branchbran 100% 2 / 2 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 3 / 3 Podpod 0.0% 0 / 2 totaltotal 93.7% 30 / 32 CC 3 SCAR 7.9
CC
3
Cov
100%
login
3.0
BEGIN
1.0
logout
1.0
CRAP 2.2
« Galileo/DB/Deploy.pm ↑ Summary Galileo/Plugin/Deploy.pm »
1 package Galileo::User;
2 3 ▶use Mojo::Base 'Mojolicious::Controller';
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 5 ▶sub login {
Subroutine login: called CC=3 SCAR=11.0
Pod undocumented
5 5 my $self = shift;
6 5 my $name = $self->param('username');
7 5 my $pass = $self->param('password');
8 5 my $from = $self->param('from');
9  
10 5 my $schema = $self->schema;
11  
12 5 my $user = $schema->resultset('User')->single({name => $name});
13 5 ▶ if ($user and $user->check_password($pass)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($user and $user->check_password($pass)) { } 3 2 5
Condition100%3/3
$user and $user->check_password($pass)
!ll&&!rl&&r
113
MC/DC100%2/2
$user and $user->check_password($pass)
$user $user->check_password($pass)
Truth table100%3/3
A and B
A= $userB= $user->check_password($pass)
ABresult
0X0
100
111
14 3 $self->humane_flash( 'Welcome Back!' );
15 3 $self->session->{id} = $user->user_id;
16 3 $self->session->{username} = $name;
17 } else {
18 2 $self->humane_flash( 'Sorry try again' );
19 }
20 5 $self->redirect_to( $from );
21 }
22  
23 1 ▶sub logout {
Subroutine logout: called CC=1 SCAR=0.0
Pod undocumented
24 1 my $self = shift;
25 1 $self->session( expires => 1 );
26 1 $self->humane_flash( 'Goodbye' );
27 1 $self->redirect_to( $self->home_page );
28 }
29  
30 3 1;
31  
« Galileo/DB/Deploy.pm ↑ Summary Galileo/Plugin/Deploy.pm »