Bugzilla – Attachment 111078 Details for
Bug 26589
t/db_dependent/OAI/Sets.t unit test fails due to OAI-PMH:AutoUpdateSets syspref
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26589: Fix t/db_dependent/OAI/Sets.t failing when OAI-PMH:AutoUpdateSets is enabled
Bug-26589-Fix-tdbdependentOAISetst-failing-when-OA.patch (text/plain), 3.34 KB, created by
David Nind
on 2020-10-02 09:43:30 UTC
(
hide
)
Description:
Bug 26589: Fix t/db_dependent/OAI/Sets.t failing when OAI-PMH:AutoUpdateSets is enabled
Filename:
MIME Type:
Creator:
David Nind
Created:
2020-10-02 09:43:30 UTC
Size:
3.34 KB
patch
obsolete
>From 0faae8b2f501830daab5976fb05b9e46d6013da6 Mon Sep 17 00:00:00 2001 >From: Alex Buckley <alexbuckley@catalyst.net.nz> >Date: Tue, 29 Sep 2020 05:53:34 +0000 >Subject: [PATCH] Bug 26589: Fix t/db_dependent/OAI/Sets.t failing when > OAI-PMH:AutoUpdateSets is enabled > >Test plan: >1. Check the OAI-PMH:AutoUpdateSets syspref is disabled >2. Run t/db_dependent/OAI/Sets.t tests and confirm tests pass >successfully >3. Enabled the OAI-PMH:AutoUpdateSets syspref >4. Repeat step 2 and confirm the tests fail > >5. Apply this patch and restart plack: sudo koha-plack --restart ><instance> >6. Repeat step 2 and confirm the tests now pass >7. Disable the OAI-PMH:AutoUpdateSets syspref and repeat step 2 and >confirm tests still pass > >Sponsored-By: Catalyst IT > >Signed-off-by: David Nind <david@davidnind.com> >--- > t/db_dependent/OAI/Sets.t | 30 ++++++++++++++++++++++++++++-- > 1 file changed, 28 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/OAI/Sets.t b/t/db_dependent/OAI/Sets.t >index 6bc08dac13..8db222feb9 100755 >--- a/t/db_dependent/OAI/Sets.t >+++ b/t/db_dependent/OAI/Sets.t >@@ -18,7 +18,7 @@ > > use Modern::Perl; > >-use Test::More tests => 147; >+use Test::More tests => 152; > use Test::MockModule; > use Test::Warn; > use MARC::Record; >@@ -28,6 +28,7 @@ use C4::Biblio; > use C4::OAI::Sets; > > use t::lib::TestBuilder; >+use t::lib::Mocks; > > my $schema = Koha::Database->new->schema; > $schema->storage->txn_begin; >@@ -349,11 +350,13 @@ is ($mappings->{$set2_id}->[0]->{operator}, 'equal', 'operator field is "equal"' > is ($mappings->{$set2_id}->[0]->{marcvalue}, 'myOtherMarcValue', 'marcvalue field is "myOtherMarcValue"'); > > >-# ---------- Testing AddOAISetsBiblios ---------- >+# ---------- Testing AddOAISetsBiblios with OAI-PMH:AutoUpdateSets disabled ---------- > ok (!defined(AddOAISetsBiblios), 'AddOAISetsBiblios without argument is undef'); > ok (!defined(AddOAISetsBiblios(my $arg=[])), 'AddOAISetsBiblios with a no HASH argument is undef'); > ok (defined(AddOAISetsBiblios($arg={})), 'AddOAISetsBiblios with a HASH argument is def'); > >+t::lib::Mocks::mock_preference( 'OAI-PMH:AutoUpdateSets', 0 ); >+ > # Create a biblio instance for testing > my $biblio_1 = $builder->build_sample_biblio({ author => 'Moffat, Steven' }); > my $biblionumber1 = $biblio_1->biblionumber; >@@ -394,6 +397,29 @@ $sth->execute($set2_id); > $count = $sth->rows; > is ($count, '0', '$set_id2 has 0 biblio'); > >+# ---------- Testing AddOAISetsBiblios with OAI-PMH:AutoUpdateSets enabled ---------- >+ >+t::lib::Mocks::mock_preference( 'OAI-PMH:AutoUpdateSets', 1 ); >+ >+my $biblio_3 = $builder->build_sample_biblio({ author => 'Moffat, Steven' }); >+my $biblionumber3 = $biblio_3->biblionumber; >+isa_ok(\$biblionumber3, 'SCALAR', '$biblionumber3 is a SCALAR'); >+ >+$sth = $dbh->prepare("SELECT count(*) FROM oai_sets_biblios"); >+$sth->execute; >+$bibliosCount = $sth->fetchrow_array; >+is ($bibliosCount, 3, 'There are 3 biblios in oai_sets_biblios'); >+ >+#testing biblio for set1_id >+$sth = $dbh->prepare("SELECT * FROM oai_sets_biblios WHERE set_id = ?"); >+$sth->execute($set1_id); >+$count = $sth->rows; >+is ($count, '3', '$set_id1 has 3 biblio'); >+ >+$sth->execute($set1_id); >+$line = ${ $sth->fetchall_arrayref( {} ) }[2]; >+is($line->{set_id}, $set1_id, "set_id is good"); >+is($line->{biblionumber}, $biblionumber3, "biblionumber is good"); > > # ---------- Testing GetOAISetsBiblio ----------- > $oai_sets = GetOAISetsBiblio($biblionumber1); >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 26589
:
111050
|
111078
|
111538