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.50';
3             # ABSTRACT: utility class to mock Selenium::Remote::Commands
4              
5 4     4   315263 use strict;
  4         11  
  4         155  
6 4     4   21 use warnings;
  4         8  
  4         222  
7              
8 4     4   896 use Moo;
  4         14056  
  4         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 2237 my $self = shift;
16 90         133 my $args = shift;
17 90         154 my $data = {};
18 90         190 my $command = delete $args->{command};
19 90         344 $data->{'url'} = $self->get_url($command);
20 90         1052 $data->{'method'} = $self->get_method($command);
21 90         895 $data->{'no_content_success'} = $self->get_no_content_success($command);
22 90         805 $data->{'url_params'} = $args;
23 90         250 return $data;
24             }
25              
26             sub get_method_name_from_parameters {
27 98     98 0 144 my $self = shift;
28 98         135 my $params = shift;
29 98         146 my $method_name = '';
30 98         2107 my $cmds = $self->get_cmds();
31 98         688 foreach my $cmd ( keys %{$cmds} ) {
  98         1414  
32 3099 100 100     9763 if ( ( $cmds->{$cmd}->{method} eq $params->{method} )
33             && ( $cmds->{$cmd}->{url} eq $params->{url} ) )
34             {
35 98         172 $method_name = $cmd;
36 98         180 last;
37             }
38             }
39 98         778 return $method_name;
40             }
41              
42             1;
43              
44             __END__