File Coverage

blib/lib/Selenium/Remote/Mock/Commands.pm
Criterion Covered Total %
statement 28 28 100.0
branch 2 2 100.0
condition 3 3 100.0
subroutine 5 5 100.0
pod 0 2 0.0
total 38 40 95.0


line stmt bran cond sub pod time code
1             package Selenium::Remote::Mock::Commands;
2             $Selenium::Remote::Mock::Commands::VERSION = '1.49';
3             # ABSTRACT: utility class to mock Selenium::Remote::Commands
4              
5 3     3   74233 use strict;
  3         19  
  3         102  
6 3     3   18 use warnings;
  3         6  
  3         102  
7              
8 3     3   652 use Moo;
  3         11731  
  3         20  
9             extends 'Selenium::Remote::Commands';
10              
11              
12             # override get_params so we do not rewrite the parameters
13              
14             sub get_params {
15 90     90 0 775 my $self = shift;
16 90         146 my $args = shift;
17 90         174 my $data = {};
18 90         205 my $command = delete $args->{command};
19 90         320 $data->{'url'} = $self->get_url($command);
20 90         891 $data->{'method'} = $self->get_method($command);
21 90         767 $data->{'no_content_success'} = $self->get_no_content_success($command);
22 90         676 $data->{'url_params'} = $args;
23 90         207 return $data;
24             }
25              
26             sub get_method_name_from_parameters {
27 98     98 0 178 my $self = shift;
28 98         151 my $params = shift;
29 98         165 my $method_name = '';
30 98         1768 my $cmds = $self->get_cmds();
31 98         686 foreach my $cmd ( keys %{$cmds} ) {
  98         1245  
32 3561 100 100     9585 if ( ( $cmds->{$cmd}->{method} eq $params->{method} )
33             && ( $cmds->{$cmd}->{url} eq $params->{url} ) )
34             {
35 98         164 $method_name = $cmd;
36 98         169 last;
37             }
38             }
39 98         583 return $method_name;
40             }
41              
42             1;
43              
44             __END__