From bcc0f17317c09de7972727f1503e5c4dc820f35c Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Thu, 14 Dec 2023 15:32:56 -0100 Subject: [PATCH] Bug 35581: Koha::Illrequest::Config -> Koha::ILL::Request::Config Signed-off-by: David Nind Signed-off-by: Pedro Amorim Signed-off-by: Katrin Fischer --- Koha/{Illrequest => ILL/Request}/Config.pm | 8 +-- Koha/Illrequest.pm | 2 +- Koha/Illrequests.pm | 4 +- Koha/REST/V1/ILL/Backends.pm | 2 +- about.pl | 4 +- ill/ill-requests.pl | 2 +- misc/process_ill_updates.pl | 2 +- opac/opac-illrequests.pl | 4 +- t/db_dependent/Illrequests.t | 4 +- t/db_dependent/Koha/ILL/Comments.t | 2 +- .../{Illrequest => Koha/ILL/Request}/Config.t | 54 +++++++++---------- t/db_dependent/api/v1/ill_backends.t | 4 +- t/db_dependent/api/v1/ill_requests.t | 4 +- 13 files changed, 48 insertions(+), 48 deletions(-) rename Koha/{Illrequest => ILL/Request}/Config.pm (98%) rename t/db_dependent/{Illrequest => Koha/ILL/Request}/Config.t (90%) diff --git a/Koha/Illrequest/Config.pm b/Koha/ILL/Request/Config.pm similarity index 98% rename from Koha/Illrequest/Config.pm rename to Koha/ILL/Request/Config.pm index ff2891700c..111317804c 100644 --- a/Koha/Illrequest/Config.pm +++ b/Koha/ILL/Request/Config.pm @@ -1,4 +1,4 @@ -package Koha::Illrequest::Config; +package Koha::ILL::Request::Config; # Copyright 2013,2014 PTFS Europe Ltd # @@ -27,7 +27,7 @@ use List::MoreUtils qw( uniq ); =head1 NAME -Koha::Illrequest::Config - Koha ILL Configuration Object +Koha::ILL::Request::Config - Koha ILL Configuration Object =head1 SYNOPSIS @@ -54,9 +54,9 @@ The config file also provides mappings for Record Object accessors. =head3 new - my $config = Koha::Illrequest::Config->new(); + my $config = Koha::ILL::Request::Config->new(); -Create a new Koha::Illrequest::Config object, with mapping data loaded from the +Create a new Koha::ILL::Request::Config object, with mapping data loaded from the ILL configuration file. =cut diff --git a/Koha/Illrequest.pm b/Koha/Illrequest.pm index 774f3de146..8f4b396c9c 100644 --- a/Koha/Illrequest.pm +++ b/Koha/Illrequest.pm @@ -534,7 +534,7 @@ sub _config { $self->{_my_config} = $config if ( $config ); # Load our config object, as late as possible. unless ( $self->{_my_config} ) { - $self->{_my_config} = Koha::Illrequest::Config->new; + $self->{_my_config} = Koha::ILL::Request::Config->new; } return $self->{_my_config}; } diff --git a/Koha/Illrequests.pm b/Koha/Illrequests.pm index 3d2b91237e..2146c1e491 100644 --- a/Koha/Illrequests.pm +++ b/Koha/Illrequests.pm @@ -21,7 +21,7 @@ use Modern::Perl; use Koha::Database; use Koha::Illrequest; -use Koha::Illrequest::Config; +use Koha::ILL::Request::Config; use base qw(Koha::Objects); @@ -50,7 +50,7 @@ sub new { my $self = $class->SUPER::new($class, $attributes); - my $config = Koha::Illrequest::Config->new; # <- Necessary + my $config = Koha::ILL::Request::Config->new; # <- Necessary $self->{_config} = $config; # <- Necessary return $self; diff --git a/Koha/REST/V1/ILL/Backends.pm b/Koha/REST/V1/ILL/Backends.pm index 58eec04a2c..d2b78d008c 100644 --- a/Koha/REST/V1/ILL/Backends.pm +++ b/Koha/REST/V1/ILL/Backends.pm @@ -19,7 +19,7 @@ use Modern::Perl; use Mojo::Base 'Mojolicious::Controller'; -use Koha::Illrequest::Config; +use Koha::ILL::Request::Config; use Koha::Illrequests; use Koha::ILL::Backend; diff --git a/about.pl b/about.pl index c5f7f73f37..5ac652b157 100755 --- a/about.pl +++ b/about.pl @@ -53,7 +53,7 @@ use Koha::Patron::Categories; use Koha::Patrons; use Koha::Caches; use Koha::Config::SysPrefs; -use Koha::Illrequest::Config; +use Koha::ILL::Request::Config; use Koha::SearchEngine::Elasticsearch; use Koha::Logger; use Koha::Filter::MARC::ViewPolicy; @@ -300,7 +300,7 @@ unless ( Koha::I18N->_base_directory ) { if ( C4::Context->preference('ILLModule') ) { my $warnILLConfiguration = 0; my $ill_config_from_file = C4::Context->config("interlibrary_loans"); - my $ill_config = Koha::Illrequest::Config->new; + my $ill_config = Koha::ILL::Request::Config->new; my $available_ill_backends = ( scalar @{ $ill_config->available_backends } > 0 ); diff --git a/ill/ill-requests.pl b/ill/ill-requests.pl index e5f7c27c5b..cfe3df65fc 100755 --- a/ill/ill-requests.pl +++ b/ill/ill-requests.pl @@ -62,7 +62,7 @@ my ( $template, $patronnumber, $cookie ) = get_template_and_user( { } ); # Are we able to actually work? -my $cfg = Koha::Illrequest::Config->new; +my $cfg = Koha::ILL::Request::Config->new; my $backends = $cfg->available_backends; my $has_branch = $cfg->has_branch; my $backends_available = ( scalar @{$backends} > 0 ); diff --git a/misc/process_ill_updates.pl b/misc/process_ill_updates.pl index 85b05d2a00..fb2e22544c 100755 --- a/misc/process_ill_updates.pl +++ b/misc/process_ill_updates.pl @@ -58,7 +58,7 @@ if (!$backend) { } # First check we can proceed -my $cfg = Koha::Illrequest::Config->new; +my $cfg = Koha::ILL::Request::Config->new; my $backends = $cfg->available_backends; my $has_branch = $cfg->has_branch; my $backends_available = ( scalar @{$backends} > 0 ); diff --git a/opac/opac-illrequests.pl b/opac/opac-illrequests.pl index 07f78e95fd..d531955b4a 100755 --- a/opac/opac-illrequests.pl +++ b/opac/opac-illrequests.pl @@ -27,7 +27,7 @@ use C4::Koha; use C4::Output qw( output_html_with_http_headers ); use POSIX qw( strftime ); -use Koha::Illrequest::Config; +use Koha::ILL::Request::Config; use Koha::Illrequests; use Koha::Illrequest; use Koha::Libraries; @@ -56,7 +56,7 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user({ # Are we able to actually work? my $reduced = C4::Context->preference('ILLOpacbackends'); -my $backends = Koha::Illrequest::Config->new->available_backends($reduced); +my $backends = Koha::ILL::Request::Config->new->available_backends($reduced); my $backends_available = ( scalar @{$backends} > 0 ); $template->param( backends_available => $backends_available ); my $patron = Koha::Patrons->find($loggedinuser); diff --git a/t/db_dependent/Illrequests.t b/t/db_dependent/Illrequests.t index 3d55467ac8..538a24c11b 100755 --- a/t/db_dependent/Illrequests.t +++ b/t/db_dependent/Illrequests.t @@ -23,7 +23,7 @@ use C4::Circulation qw( AddIssue AddReturn ); use Koha::Database; use Koha::ILL::Request::Attributes; -use Koha::Illrequest::Config; +use Koha::ILL::Request::Config; use Koha::Biblios; use Koha::Patrons; use Koha::ItemTypes; @@ -60,7 +60,7 @@ subtest 'Basic object tests' => sub { isa_ok($illrq_obj, 'Koha::Illrequest', "Correctly create and load an illrequest object."); - isa_ok($illrq_obj->_config, 'Koha::Illrequest::Config', + isa_ok($illrq_obj->_config, 'Koha::ILL::Request::Config', "Created a config object as part of Illrequest creation."); is($illrq_obj->illrequest_id, $illrq->{illrequest_id}, diff --git a/t/db_dependent/Koha/ILL/Comments.t b/t/db_dependent/Koha/ILL/Comments.t index 0994288333..dbe1dd2c44 100755 --- a/t/db_dependent/Koha/ILL/Comments.t +++ b/t/db_dependent/Koha/ILL/Comments.t @@ -21,7 +21,7 @@ use File::Basename qw/basename/; use Koha::Database; use Koha::Illrequests; use Koha::ILL::Request::Attributes; -use Koha::Illrequest::Config; +use Koha::ILL::Request::Config; use Koha::Patrons; use t::lib::Mocks; use t::lib::TestBuilder; diff --git a/t/db_dependent/Illrequest/Config.t b/t/db_dependent/Koha/ILL/Request/Config.t similarity index 90% rename from t/db_dependent/Illrequest/Config.t rename to t/db_dependent/Koha/ILL/Request/Config.t index 1034abbec2..f511726c30 100755 --- a/t/db_dependent/Illrequest/Config.t +++ b/t/db_dependent/Koha/ILL/Request/Config.t @@ -27,7 +27,7 @@ use Test::More tests => 5; my $schema = Koha::Database->new->schema; my $builder = t::lib::TestBuilder->new; -use_ok('Koha::Illrequest::Config'); +use_ok('Koha::ILL::Request::Config'); my $base_limits = { branch => { CPL => { count => 1, method => 'annual' } }, @@ -46,8 +46,8 @@ subtest 'Basics' => sub { t::lib::Mocks::mock_config("interlibrary_loans", {}); t::lib::Mocks::mock_preference('ILLPartnerCode', undef); - my $config = Koha::Illrequest::Config->new; - isa_ok($config, "Koha::Illrequest::Config", + my $config = Koha::ILL::Request::Config->new; + isa_ok($config, "Koha::ILL::Request::Config", "Correctly create and load a config object."); # backend: @@ -98,22 +98,22 @@ subtest '_load_unit_config' => sub { $schema->storage->txn_begin; - my $config = Koha::Illrequest::Config->new; + my $config = Koha::ILL::Request::Config->new; dies_ok( - sub { Koha::Illrequest::Config::_load_unit_config({ + sub { Koha::ILL::Request::Config::_load_unit_config({ id => 'durineadu', type => 'baz' }) }, "_load_unit_config: die if ID is not default, and type is not branch or brw_cat." ); is_deeply( - Koha::Illrequest::Config::_load_unit_config({ + Koha::ILL::Request::Config::_load_unit_config({ unit => {}, id => 'default', config => {}, test => 1 }), {}, "_load_unit_config: invocation without id returns unmodified config." ); is_deeply( - Koha::Illrequest::Config::_load_unit_config({ + Koha::ILL::Request::Config::_load_unit_config({ unit => { api_key => 'foo', api_auth => 'bar' }, id => "CPL", type => 'branch', config => {} }), @@ -123,19 +123,19 @@ subtest '_load_unit_config' => sub { # Populate request_limits is_deeply( - Koha::Illrequest::Config::_load_unit_config({ + Koha::ILL::Request::Config::_load_unit_config({ unit => { request_limit => [ 'heelo', 1234 ] }, id => "CPL", type => 'branch', config => {} }), {}, "_load_unit_config: invalid request_limit structure." ); is_deeply( - Koha::Illrequest::Config::_load_unit_config({ + Koha::ILL::Request::Config::_load_unit_config({ unit => { request_limit => { method => 'eudiren', count => '-5465' } }, id => "CPL", type => 'branch', config => {} }), {}, "_load_unit_config: invalid method & count." ); is_deeply( - Koha::Illrequest::Config::_load_unit_config({ + Koha::ILL::Request::Config::_load_unit_config({ unit => { request_limit => { method => 'annual', count => 6 } }, id => "default", config => {} }), @@ -145,7 +145,7 @@ subtest '_load_unit_config' => sub { # Populate prefix is_deeply( - Koha::Illrequest::Config::_load_unit_config({ + Koha::ILL::Request::Config::_load_unit_config({ unit => { prefix => 'Foo-ill' }, id => "default", config => {} }), @@ -153,7 +153,7 @@ subtest '_load_unit_config' => sub { "_load_unit_config: correct default prefix." ); is_deeply( - Koha::Illrequest::Config::_load_unit_config({ + Koha::ILL::Request::Config::_load_unit_config({ unit => { prefix => 'Foo-ill' }, id => "A", config => {}, type => 'brw_cat' }), @@ -163,7 +163,7 @@ subtest '_load_unit_config' => sub { # Populate digital_recipient is_deeply( - Koha::Illrequest::Config::_load_unit_config({ + Koha::ILL::Request::Config::_load_unit_config({ unit => { digital_recipient => 'borrower' }, id => "default", config => {} }), @@ -171,7 +171,7 @@ subtest '_load_unit_config' => sub { "_load_unit_config: correct default digital_recipient." ); is_deeply( - Koha::Illrequest::Config::_load_unit_config({ + Koha::ILL::Request::Config::_load_unit_config({ unit => { digital_recipient => 'branch' }, id => "A", config => {}, type => 'brw_cat' }), @@ -198,12 +198,12 @@ subtest '_load_configuration' => sub { $schema->storage->txn_begin; - my $config = Koha::Illrequest::Config->new; + my $config = Koha::ILL::Request::Config->new; t::lib::Mocks::mock_preference('ILLPartnerCode', 'IL'); # Return basic configuration is_deeply( - Koha::Illrequest::Config::_load_configuration({}, 0), + Koha::ILL::Request::Config::_load_configuration( {}, 0 ), { backend_directory => undef, censorship => { @@ -221,7 +221,7 @@ subtest '_load_configuration' => sub { # Return correct backend_dir is_deeply( - Koha::Illrequest::Config::_load_configuration({ backend_directory => '/tmp/' }, 0), + Koha::ILL::Request::Config::_load_configuration( { backend_directory => '/tmp/' }, 0 ), { backend_directory => '/tmp/', censorship => { @@ -247,7 +247,7 @@ subtest '_load_configuration' => sub { ] }; is_deeply( - Koha::Illrequest::Config::_load_configuration($xml_config, 0), + Koha::ILL::Request::Config::_load_configuration( $xml_config, 0 ), { backend_directory => '/tmp/', censorship => { @@ -273,7 +273,7 @@ subtest '_load_configuration' => sub { } }; is_deeply( - Koha::Illrequest::Config::_load_configuration($xml_config, 0), + Koha::ILL::Request::Config::_load_configuration( $xml_config, 0 ), { backend_directory => '/tmp/', censorship => { @@ -299,7 +299,7 @@ subtest '_load_configuration' => sub { ] }; is_deeply( - Koha::Illrequest::Config::_load_configuration($xml_config, 0), + Koha::ILL::Request::Config::_load_configuration( $xml_config, 0 ), { backend_directory => '/tmp/', censorship => { @@ -325,7 +325,7 @@ subtest '_load_configuration' => sub { } }; is_deeply( - Koha::Illrequest::Config::_load_configuration($xml_config, 0), + Koha::ILL::Request::Config::_load_configuration( $xml_config, 0 ), { backend_directory => '/tmp/', censorship => { @@ -349,7 +349,7 @@ subtest '_load_configuration' => sub { digital_recipient => 'branch', }; is_deeply( - Koha::Illrequest::Config::_load_configuration($xml_config, 0), + Koha::ILL::Request::Config::_load_configuration( $xml_config, 0 ), { backend_directory => '/tmp/', censorship => { @@ -372,7 +372,7 @@ subtest '_load_configuration' => sub { reply_date => 'hide' }; is_deeply( - Koha::Illrequest::Config::_load_configuration($xml_config, 0), + Koha::ILL::Request::Config::_load_configuration( $xml_config, 0 ), { backend_directory => '/tmp/', censorship => { @@ -390,7 +390,7 @@ subtest '_load_configuration' => sub { # Partner library category is_deeply( - Koha::Illrequest::Config::_load_configuration( { partner_code => 'FOOBAR' } ), + Koha::ILL::Request::Config::_load_configuration( { partner_code => 'FOOBAR' } ), { backend_directory => undef, censorship => { @@ -409,7 +409,7 @@ subtest '_load_configuration' => sub { t::lib::Mocks::mock_preference( 'ILLPartnerCode', 'FOOBAR' ); is_deeply( - Koha::Illrequest::Config::_load_configuration(), + Koha::ILL::Request::Config::_load_configuration(), { backend_directory => undef, censorship => { @@ -437,7 +437,7 @@ subtest 'Final tests' => sub { t::lib::Mocks::mock_config("interlibrary_loans", {}); - my $config = Koha::Illrequest::Config->new; + my $config = Koha::ILL::Request::Config->new; # getPrefixes (error & undef): is($config->getPrefixes(), undef, @@ -453,7 +453,7 @@ subtest 'Final tests' => sub { is_deeply($config->getDigitalRecipients("branch"), { default => undef}, "getDigitalRecipients: Undefined branch dig rec is undefined."); - $config->{configuration} = Koha::Illrequest::Config::_load_configuration({ + $config->{configuration} = Koha::ILL::Request::Config::_load_configuration({ backend_directory => '/tmp/', prefix => 'DEFAULT-prefix', digital_recipient => 'branch', diff --git a/t/db_dependent/api/v1/ill_backends.t b/t/db_dependent/api/v1/ill_backends.t index 44270cf83d..ded2424fc1 100755 --- a/t/db_dependent/api/v1/ill_backends.t +++ b/t/db_dependent/api/v1/ill_backends.t @@ -40,8 +40,8 @@ subtest 'list() tests' => sub { plan tests => 16; - # Mock Illrequest::Config (as module) - my $illconfig_module = Test::MockModule->new('Koha::Illrequest::Config'); + # Mock ILL::Request::Config (as module) + my $illconfig_module = Test::MockModule->new('Koha::ILL::Request::Config'); # Start with no backends installed $illconfig_module->mock( 'available_backends', sub { () } ); diff --git a/t/db_dependent/api/v1/ill_requests.t b/t/db_dependent/api/v1/ill_requests.t index 7822acc486..9745c5cf91 100755 --- a/t/db_dependent/api/v1/ill_requests.t +++ b/t/db_dependent/api/v1/ill_requests.t @@ -217,10 +217,10 @@ subtest 'list() tests' => sub { ->json_has('/0/comments', $comment_text); # x-koha-embed: id_prefix - # Mock Illrequest::Config to return a static prefix + # Mock ILL::Request::Config to return a static prefix my $id_prefix = 'ILL'; my $config = Test::MockObject->new; - $config->set_isa('Koha::Illrequest::Config::Mock'); + $config->set_isa('Koha::ILL::Request::Config::Mock'); $config->set_always('getPrefixes', $id_prefix); # Make sure id_prefix comes back -- 2.39.5