From 117ba8c698e730b14455de085f4fab706a1cfd11 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Wed, 19 Nov 2025 14:50:10 +0000 Subject: [PATCH] Bug 37893: (QA follow-up): Fix pod_coverage.t To test: prove -v /kohadevbox/koha/xt/author/pod_coverage.t The changes to Schema files are fixes that were overlooked originally. The 'die' line in C4/SIP/Sip/Configuration.pm is to force the script to die if SIP configuration does not exist, which only happens when running pod_coverage.t The original code (prior to 37893) did not consider the possibiliy of a config_file being invalid or undef, parser->XMLin(config_file) died silently, but because pod_coverage.t skips over files that die, it didn't fail. See bug 41271. Now, with the changes from bug 37893, if a config_file doesnt exist the code falls back to whats in the cache, so it doesn't try to XMLin load an invalid config_file anymore, and fails verbosely. --- C4/SIP/Sip/Configuration.pm | 1 + Koha/SIP2/Object.pm | 14 +++++++++++++- Koha/Schema/Result/SipAccount.pm | 13 +++++++++++++ .../Result/SipAccountSystemPreferenceOverride.pm | 12 ++++++++++++ Koha/Schema/Result/SipInstitution.pm | 13 +++++++++++++ Koha/Schema/Result/SipSystemPreferenceOverride.pm | 11 +++++++++++ 6 files changed, 63 insertions(+), 1 deletion(-) diff --git a/C4/SIP/Sip/Configuration.pm b/C4/SIP/Sip/Configuration.pm index 41b42885776..4a492f5d0de 100644 --- a/C4/SIP/Sip/Configuration.pm +++ b/C4/SIP/Sip/Configuration.pm @@ -56,6 +56,7 @@ sub get_configuration { } else { $cfg = $current_config; } + die unless $cfg; my %listeners; # The key to the listeners hash is the 'port' component of the diff --git a/Koha/SIP2/Object.pm b/Koha/SIP2/Object.pm index 2a55d217f49..6555785d723 100644 --- a/Koha/SIP2/Object.pm +++ b/Koha/SIP2/Object.pm @@ -39,7 +39,7 @@ This is the base class for SIP2 objects in the Koha library system. =head3 store -store + store wrapper =cut @@ -50,6 +50,12 @@ sub store { return $self->SUPER::store; } +=head3 delete + + delete wrapper + +=cut + sub delete { my ($self) = @_; @@ -57,6 +63,12 @@ sub delete { return $self->SUPER::delete; } +=head3 _update_config_timestamp + + Updates the sip2_resource_last_modified timestamp in cache + +=cut + sub _update_config_timestamp { my $cache = Koha::Caches->get_instance(); $cache->set_in_cache( 'sip2_resource_last_modified', dt_from_string()->epoch ); diff --git a/Koha/Schema/Result/SipAccount.pm b/Koha/Schema/Result/SipAccount.pm index 63c75b748c3..8dac7953eab 100644 --- a/Koha/Schema/Result/SipAccount.pm +++ b/Koha/Schema/Result/SipAccount.pm @@ -581,9 +581,22 @@ __PACKAGE__->add_columns( "+show_outstanding_amount" => { is_boolean => 1 } ); +=head2 koha_objects_class + + Koha Objects class + +=cut + sub koha_objects_class { 'Koha::SIP2::Accounts'; } + +=head2 koha_object_class + + Koha Object class + +=cut + sub koha_object_class { 'Koha::SIP2::Account'; } diff --git a/Koha/Schema/Result/SipAccountSystemPreferenceOverride.pm b/Koha/Schema/Result/SipAccountSystemPreferenceOverride.pm index 8ea7cf890b6..b618b0ad605 100644 --- a/Koha/Schema/Result/SipAccountSystemPreferenceOverride.pm +++ b/Koha/Schema/Result/SipAccountSystemPreferenceOverride.pm @@ -121,10 +121,22 @@ __PACKAGE__->belongs_to( # You can replace this text with custom code or comments, and it will be preserved on regeneration +=head2 koha_objects_class + + Koha Objects class + +=cut + sub koha_objects_class { 'Koha::SIP2::Accounts::SystemPreferenceOverrides'; } +=head2 koha_object_class + + Koha Object class + +=cut + sub koha_object_class { 'Koha::SIP2::Account::SystemPreferenceOverride'; } diff --git a/Koha/Schema/Result/SipInstitution.pm b/Koha/Schema/Result/SipInstitution.pm index 330789350d9..aac923dff28 100644 --- a/Koha/Schema/Result/SipInstitution.pm +++ b/Koha/Schema/Result/SipInstitution.pm @@ -195,9 +195,22 @@ __PACKAGE__->add_columns( "+status_update" => { is_boolean => 1 } ); +=head2 koha_objects_class + + Koha Objects class + +=cut + sub koha_objects_class { 'Koha::SIP2::Institutions'; } + +=head2 koha_object_class + + Koha Object class + +=cut + sub koha_object_class { 'Koha::SIP2::Institution'; } diff --git a/Koha/Schema/Result/SipSystemPreferenceOverride.pm b/Koha/Schema/Result/SipSystemPreferenceOverride.pm index 81581b42fca..a01729fe936 100644 --- a/Koha/Schema/Result/SipSystemPreferenceOverride.pm +++ b/Koha/Schema/Result/SipSystemPreferenceOverride.pm @@ -72,11 +72,22 @@ __PACKAGE__->set_primary_key("sip_system_preference_override_id"); # Created by DBIx::Class::Schema::Loader v0.07051 @ 2025-02-10 10:27:51 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:szyNGurH+wJBItdnYfAoRA +=head2 koha_objects_class + + Koha Objects class + +=cut sub koha_objects_class { 'Koha::SIP2::SystemPreferenceOverrides'; } +=head2 koha_object_class + + Koha Object class + +=cut + sub koha_object_class { 'Koha::SIP2::SystemPreferenceOverride'; } -- 2.39.5