فهرست منبع

Fix bare ref keys() calls, back to 5.10, remove dead dep from test

George S. Baugh 10 سال پیش
والد
کامیت
3a614e15ed
3فایلهای تغییر یافته به همراه6 افزوده شده و 8 حذف شده
  1. 0 1
      Changes
  2. 3 3
      lib/TestRail/API.pm
  3. 3 4
      t/TestRail-API.t

+ 0 - 1
Changes

@@ -7,7 +7,6 @@ Revision history for Perl module TestRail::API
     - Add bin/testrail-tests and bin/testrail-runs
     - Add bin/testrail-tests and bin/testrail-runs
     - Add statusNamesToIds and userNamesToIds convenience methods to TestRail::API
     - Add statusNamesToIds and userNamesToIds convenience methods to TestRail::API
     - Add getRunSummary to TestRail::API
     - Add getRunSummary to TestRail::API
-    - Minimum perl version now 5.14
 
 
 0.020 2015-03-25 TEODESIAN
 0.020 2015-03-25 TEODESIAN
     - Add getRunsPaginated and getPlansPaginated to get around 250 hardlimit in TR results
     - Add getRunsPaginated and getPlansPaginated to get around 250 hardlimit in TR results

+ 3 - 3
lib/TestRail/API.pm

@@ -23,7 +23,7 @@ I recommend using the excellent L<Attempt> module for this purpose.
 
 
 =cut
 =cut
 
 
-use 5.014;
+use 5.010;
 
 
 use strict;
 use strict;
 use warnings;
 use warnings;
@@ -1212,8 +1212,8 @@ sub getRunSummary {
     #Create listing of keys/values
     #Create listing of keys/values
     @runs = map {
     @runs = map {
         my $run = $_;
         my $run = $_;
-        @{$run->{statuses}}{grep {$_ =~ m/_count$/} keys($run)} = grep {$_ =~ m/_count$/} keys($run);
-        foreach my $status (keys($run->{'statuses'})) {
+        @{$run->{statuses}}{grep {$_ =~ m/_count$/} keys(%$run)} = grep {$_ =~ m/_count$/} keys(%$run);
+        foreach my $status (keys(%{$run->{'statuses'}})) {
             next if !exists($shash{$status});
             next if !exists($shash{$status});
             @sname = grep {exists($shash{$status}) && $_->{'id'} == $shash{$status}} @$statuses;
             @sname = grep {exists($shash{$status}) && $_->{'id'} == $shash{$status}} @$statuses;
             $run->{'statuses_clean'}->{$sname[0]->{'name'}} = $run->{$status};
             $run->{'statuses_clean'}->{$sname[0]->{'name'}} = $run->{$status};

+ 3 - 4
t/TestRail-API.t

@@ -7,8 +7,7 @@ use Test::LWP::UserAgent::TestRailMock;
 use Test::More tests => 71;
 use Test::More tests => 71;
 use Test::Fatal;
 use Test::Fatal;
 use Test::Deep;
 use Test::Deep;
-use Scalar::Util 'reftype';
-use ExtUtils::MakeMaker qw{prompt};
+use Scalar::Util ();
 
 
 my $apiurl = $ENV{'TESTRAIL_API_URL'};
 my $apiurl = $ENV{'TESTRAIL_API_URL'};
 my $login  = $ENV{'TESTRAIL_USER'};
 my $login  = $ENV{'TESTRAIL_USER'};
@@ -67,7 +66,7 @@ is($new_project->{'name'},$project_name,"Can create new project");
 ok($tr->getProjects(),"Get Projects returns list");
 ok($tr->getProjects(),"Get Projects returns list");
 is($tr->getProjectByName($project_name)->{'name'},$project_name,"Can get project by name");
 is($tr->getProjectByName($project_name)->{'name'},$project_name,"Can get project by name");
 my $pjid = $tr->getProjectByID($new_project->{'id'});
 my $pjid = $tr->getProjectByID($new_project->{'id'});
-is(reftype($pjid) eq 'HASH' ? $pjid->{'id'} : $pjid,$new_project->{'id'},"Can get project by id");
+is(Scalar::Util::reftype($pjid) eq 'HASH' ? $pjid->{'id'} : $pjid,$new_project->{'id'},"Can get project by id");
 
 
 #Test TESTSUITE methods
 #Test TESTSUITE methods
 my $suite_name = 'HAMBURGER-IZE HUMANITY';
 my $suite_name = 'HAMBURGER-IZE HUMANITY';
@@ -182,7 +181,7 @@ is($summary->{'run_status'}->{'untested'},int($is_mock),"Gets # of untested case
 
 
 #Test configuration methods
 #Test configuration methods
 my $configs = $tr->getConfigurations($new_project->{'id'});
 my $configs = $tr->getConfigurations($new_project->{'id'});
-my $is_arr = is(reftype($configs),'ARRAY',"Can get configurations for a project");
+my $is_arr = is(Scalar::Util::reftype($configs),'ARRAY',"Can get configurations for a project");
 my (@config_names,@config_ids);
 my (@config_names,@config_ids);
 if ($is_arr) {
 if ($is_arr) {
     @config_names = map {$_->{'name'}} @$configs;
     @config_names = map {$_->{'name'}} @$configs;