Bug 35581: Koha::Illrequest::Config -> Koha::ILL::Request::Config

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Pedro Amorim 2023-12-14 15:32:56 -01:00 committed by Katrin Fischer
parent fb2d14901b
commit bcc0f17317
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
13 changed files with 48 additions and 48 deletions

View File

@ -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

View File

@ -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};
}

View File

@ -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;

View File

@ -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;

View File

@ -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 );

View File

@ -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 );

View File

@ -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 );

View File

@ -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);

View File

@ -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},

View File

@ -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;

View File

@ -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',

View File

@ -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 { () } );

View File

@ -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