From e0652aaa172c3b4c87e2db5409eddc731083dee0 Mon Sep 17 00:00:00 2001 From: Josef Moravec Date: Tue, 12 Mar 2019 13:46:14 +0000 Subject: [PATCH] Bug 8995: (follow-up) Added test Signed-off-by: Magnus Enger Signed-off-by: Martin Renvoize --- t/db_dependent/Biblio.t | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/t/db_dependent/Biblio.t b/t/db_dependent/Biblio.t index dd96e546ff..cf9488812e 100755 --- a/t/db_dependent/Biblio.t +++ b/t/db_dependent/Biblio.t @@ -590,3 +590,32 @@ subtest 'ModBiblio called from linker test' => sub { # Cleanup Koha::Caches->get_instance->clear_from_cache( "MarcSubfieldStructure-" ); $schema->storage->txn_rollback; + +subtest 'GetCOinSBiblio and GetOpenURLResolverURL' => sub { + plan tests => 2; + + $schema->storage->txn_begin; + + my $builder = t::lib::TestBuilder->new; + my $biblio = $builder->build_sample_biblio({ + title => 'Title 1', + author => 'Author 1' + }); + my $record = $biblio->metadata->record; + + t::lib::Mocks::mock_preference("OpenURLResolverURL", "https://koha.example.com/"); + + is( + C4::Biblio::GetCOinSBiblio($record), + 'ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitle=Title%201&rft.au=Author%201', + 'GetCOinsBiblio returned right metadata' + ); + + is( + C4::Biblio::GetOpenURLResolverURL($record), + 'https://koha.example.com/?ctx_ver=Z39.88-2004&rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&rft.genre=book&rft.btitle=Title%201&rft.au=Author%201', + 'GetOpenURLResolverURL returned right URL' + ); + + $schema->storage->txn_rollback; +}; -- 2.20.1