From 7c68fb26737206c4fae05e2841a0439038512cca Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 10 Dec 2015 12:56:44 +0000 Subject: [PATCH] Bug 14939: Remove the Capture::Tiny dependency MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit It's possible to redirect the std output to a variable, it will avoid to add this new dependency. Signed-off-by: Frédéric Demians OK. + code factorisation with a function call. Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall --- C4/Installer/PerlDependencies.pm | 5 ----- t/db_dependent/OAI/Server.t | 15 ++++++++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/C4/Installer/PerlDependencies.pm b/C4/Installer/PerlDependencies.pm index 99fd9aa3c8..778e101970 100644 --- a/C4/Installer/PerlDependencies.pm +++ b/C4/Installer/PerlDependencies.pm @@ -787,11 +787,6 @@ our $PERL_DEPS = { 'required' => '0', 'min_ver' => '0.03', }, - 'Capture::Tiny' => { - 'usage' => 'Core', - 'required' => '0', - 'min_ver' => '0.18', - }, }; 1; diff --git a/t/db_dependent/OAI/Server.t b/t/db_dependent/OAI/Server.t index 21470681ef..4e2d6262b8 100644 --- a/t/db_dependent/OAI/Server.t +++ b/t/db_dependent/OAI/Server.t @@ -25,7 +25,6 @@ use Test::More tests => 13; use Test::MockModule; use Test::Warn; use DateTime; -use Capture::Tiny ':all'; use XML::Simple; use t::lib::Mocks; @@ -74,8 +73,15 @@ t::lib::Mocks::mock_preference('OAI-PMH:MaxCount', 3); t::lib::Mocks::mock_preference('OAI-PMH:DeletedRecord', 'persistent'); %param = ( verb => 'ListMetadataFormats' ); -my ($response) = capture { Koha::OAI::Server::Repository->new(); }; -$response = XMLin($response); +my $response; +my $get_response = sub { + my $stdout; + local *STDOUT; + open STDOUT, '>', \$stdout; + Koha::OAI::Server::Repository->new(); + $response = XMLin($stdout); +}; +$get_response->(); my $now = DateTime->now . 'Z'; my $expected = { request => 'http://localhost', @@ -101,8 +107,7 @@ my $expected = { is_deeply($response, $expected, "ListMetadataFormats"); %param = ( verb => 'ListIdentifiers' ); -($response) = capture { Koha::OAI::Server::Repository->new(); }; -$response = XMLin($response); +$get_response->(); $now = DateTime->now . 'Z'; $expected = { request => 'http://localhost', -- 2.39.5