Pedro Amorim
ac157b7a75
Koha/Illrequests.pm -> Koha/ILL/Requests.pm Merged: t/db_dependent/Koha/Illrequests.t t/db_dependent/Illrequests.t Into: t/db_dependent/Koha/ILL/Requests.t ILL classes file structure is, for the most part, around 7 years old and doesn't follow a strict logic. It's so confusing that some test files exist redundantly. This housekeeping should help future work in regards to ISO18626 to add Koha as a supplying agency instead of just requesting agency, as is now. It should also help future housekeeping of moving backend related logic out of the Illrequest.pm into Illbackend.pm (now ILL/Request.pm and ILL/Backend.pm as of this patchset). It should also help in structuring the addition of a master generic form (see bug 35570) This patchset will require existing backends to be updated to match the new class names and structure, if they invoke them. Test plan, k-t-d, run tests: prove t/db_dependent/api/v1/ill_* prove t/db_dependent/Koha/ILL/* Test plan, k-t-d, manual: 1) Install FreeForm, enable ILL module, run: bash <(curl -s https://raw.githubusercontent.com/ammopt/koha-ill-dev/master/start-ill-dev.sh) 2) You'll have to switch the FreeForm repo to the one compatible with this work, like: cd /kohadevbox/koha/Koha/Illbackends/FreeForm git checkout reorganize_ILL 3) Do some generic ILL testing: 3.1) Create a request 3.2) Add a comment to a request 3.3) Edit a request 3.4) Edit a request's item metadata 3.5) Confirm a request 3.6) List requests 3.7) Filter requests list using left side filters 4) Install a metadata enrichment plugin: https://github.com/PTFS-Europe/koha-plugin-api-pubmed 4.1) Create an ILL batch and insert a pubmedid like 123 4.2) Add the request and finish batch 5) Verify all of the above works as expected Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
64 lines
1.6 KiB
Perl
Executable file
64 lines
1.6 KiB
Perl
Executable file
#!/usr/bin/perl
|
|
|
|
# This file is part of Koha.
|
|
#
|
|
# Koha is free software; you can redistribute it and/or modify it
|
|
# under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# Koha is distributed in the hope that it will be useful, but
|
|
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with Koha; if not, see <http://www.gnu.org/licenses>.
|
|
|
|
use Modern::Perl;
|
|
|
|
use Test::MockObject;
|
|
|
|
use Koha::ILL::Request;
|
|
use Koha::ILL::Request::SupplierUpdate;
|
|
|
|
use Test::More tests => 4;
|
|
|
|
use_ok('Koha::ILL::Request::SupplierUpdate');
|
|
|
|
my $update = Koha::ILL::Request::SupplierUpdate->new(
|
|
'test_type',
|
|
'test_name',
|
|
'Arbitrary update text'
|
|
);
|
|
|
|
isa_ok( $update, 'Koha::ILL::Request::SupplierUpdate' );
|
|
|
|
my $processor = Test::MockObject->new;
|
|
$processor->set_isa('Koha::ILL::Request::Processor');
|
|
$processor->{name} = 'Test processor';
|
|
$processor->mock('run', sub {
|
|
my ( $self, $update, $options, $result ) = @_;
|
|
push @{$result->{success}}, 'Hello';
|
|
});
|
|
|
|
# attach_processor
|
|
$update->attach_processor($processor);
|
|
is(
|
|
scalar @{$update->{processors}},
|
|
1,
|
|
'attach_processors works'
|
|
);
|
|
|
|
# run_processors
|
|
is_deeply(
|
|
$update->run_processors({}),
|
|
[{
|
|
name => 'Test processor',
|
|
result => {
|
|
success => ['Hello'],
|
|
error => []
|
|
}
|
|
}],
|
|
'run_processors calls attached processors'
|
|
);
|