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.47';
3             # ABSTRACT: utility class to mock Selenium::Remote::Commands
4              
5 3     3   63952 use strict;
  3         15  
  3         78  
6 3     3   12 use warnings;
  3         5  
  3         65  
7              
8 3     3   471 use Moo;
  3         10009  
  3         15  
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 630 my $self = shift;
16 90         103 my $args = shift;
17 90         126 my $data = {};
18 90         160 my $command = delete $args->{command};
19 90         243 $data->{'url'} = $self->get_url($command);
20 90         700 $data->{'method'} = $self->get_method($command);
21 90         622 $data->{'no_content_success'} = $self->get_no_content_success($command);
22 90         544 $data->{'url_params'} = $args;
23 90         177 return $data;
24             }
25              
26             sub get_method_name_from_parameters {
27 98     98 0 147 my $self = shift;
28 98         129 my $params = shift;
29 98         131 my $method_name = '';
30 98         1431 my $cmds = $self->get_cmds();
31 98         552 foreach my $cmd ( keys %{$cmds} ) {
  98         978  
32 4421 100 100     9325 if ( ( $cmds->{$cmd}->{method} eq $params->{method} )
33             && ( $cmds->{$cmd}->{url} eq $params->{url} ) )
34             {
35 98         160 $method_name = $cmd;
36 98         150 last;
37             }
38             }
39 98         437 return $method_name;
40             }
41              
42             1;
43              
44             __END__