Bugzilla – Attachment 180127 Details for
Bug 39405
Add plugin hook `overwrite_calc_fine` to override fine calculation
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39405: Add more plugin examples to build tests
Bug-39405-Add-more-plugin-examples-to-build-tests.patch (text/plain), 4.38 KB, created by
Tomás Cohen Arazi (tcohen)
on 2025-04-01 10:12:30 UTC
(
hide
)
Description:
Bug 39405: Add more plugin examples to build tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2025-04-01 10:12:30 UTC
Size:
4.38 KB
patch
obsolete
>From b8c068a70d5b5b3b8aef3a3c408b377d0566492a Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 1 Apr 2025 12:11:43 +0200 >Subject: [PATCH] Bug 39405: Add more plugin examples to build tests > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/Koha/Plugins/Overdues.t | 5 ++- > t/lib/plugins/Koha/Plugin/CalcFineBadValue.pm | 34 +++++++++++++++++++ > t/lib/plugins/Koha/Plugin/CalcFineEmpty.pm | 34 +++++++++++++++++++ > t/lib/plugins/Koha/Plugin/CalcFineNotEmpty.pm | 33 ++++++++++++++++++ > 4 files changed, 105 insertions(+), 1 deletion(-) > create mode 100644 t/lib/plugins/Koha/Plugin/CalcFineBadValue.pm > create mode 100644 t/lib/plugins/Koha/Plugin/CalcFineEmpty.pm > create mode 100644 t/lib/plugins/Koha/Plugin/CalcFineNotEmpty.pm > >diff --git a/t/db_dependent/Koha/Plugins/Overdues.t b/t/db_dependent/Koha/Plugins/Overdues.t >index 38a2e013dd9..f94fdd33565 100755 >--- a/t/db_dependent/Koha/Plugins/Overdues.t >+++ b/t/db_dependent/Koha/Plugins/Overdues.t >@@ -17,7 +17,7 @@ > use Modern::Perl; > > use Test::NoWarnings; >-use Test::More tests => 6; >+use Test::More tests => 9; > > use C4::Overdues qw(CalcFine); > >@@ -34,6 +34,9 @@ BEGIN { > use_ok('C4::Overdues'); > use_ok('Koha::Plugins'); > use_ok('Koha::Plugins::Handler'); >+ use_ok('Koha::Plugin::CalcFineEmpty'); >+ use_ok('Koha::Plugin::CalcFineNotEmpty'); >+ use_ok('Koha::Plugin::CalcFineBadValue'); > use_ok('Koha::Plugin::Test'); > } > >diff --git a/t/lib/plugins/Koha/Plugin/CalcFineBadValue.pm b/t/lib/plugins/Koha/Plugin/CalcFineBadValue.pm >new file mode 100644 >index 00000000000..95aa3704878 >--- /dev/null >+++ b/t/lib/plugins/Koha/Plugin/CalcFineBadValue.pm >@@ -0,0 +1,34 @@ >+package Koha::Plugin::CalcFineBadValue; >+ >+use Modern::Perl; >+ >+use base qw(Koha::Plugins::Base); >+ >+our $VERSION = "0.0.1"; >+our $metadata = { >+ name => 'Calc Fine Plugin', >+ author => 'Kyle M Hall', >+ description => 'Test plugin', >+ date_authored => '2013-01-14', >+ date_updated => '2013-01-14', >+ minimum_version => '3.11', >+ maximum_version => undef, >+ version => $VERSION, >+ namespace => 'calc_fine_bad_value', >+ my_example_tag => 'find_me', >+}; >+ >+sub new { >+ my ( $class, $args ) = @_; >+ $args->{'metadata'} = $metadata; >+ my $self = $class->SUPER::new($args); >+ return $self; >+} >+ >+sub overwrite_calc_fine { >+ my ( $self, $params ) = @_; >+ >+ return [ "a", "b" ]; >+} >+ >+1; >diff --git a/t/lib/plugins/Koha/Plugin/CalcFineEmpty.pm b/t/lib/plugins/Koha/Plugin/CalcFineEmpty.pm >new file mode 100644 >index 00000000000..5bd3132c60a >--- /dev/null >+++ b/t/lib/plugins/Koha/Plugin/CalcFineEmpty.pm >@@ -0,0 +1,34 @@ >+package Koha::Plugin::CalcFineEmpty; >+ >+use Modern::Perl; >+ >+use base qw(Koha::Plugins::Base); >+ >+our $VERSION = "0.0.1"; >+our $metadata = { >+ name => 'Calc Fine Plugin', >+ author => 'Kyle M Hall', >+ description => 'Test plugin', >+ date_authored => '2013-01-14', >+ date_updated => '2013-01-14', >+ minimum_version => '3.11', >+ maximum_version => undef, >+ version => $VERSION, >+ namespace => 'calc_fine_empty', >+ my_example_tag => 'find_me', >+}; >+ >+sub new { >+ my ( $class, $args ) = @_; >+ $args->{'metadata'} = $metadata; >+ my $self = $class->SUPER::new($args); >+ return $self; >+} >+ >+sub overwrite_calc_fine { >+ my ( $self, $params ) = @_; >+ >+ return undef; >+} >+ >+1; >diff --git a/t/lib/plugins/Koha/Plugin/CalcFineNotEmpty.pm b/t/lib/plugins/Koha/Plugin/CalcFineNotEmpty.pm >new file mode 100644 >index 00000000000..5d4ab557670 >--- /dev/null >+++ b/t/lib/plugins/Koha/Plugin/CalcFineNotEmpty.pm >@@ -0,0 +1,33 @@ >+package Koha::Plugin::CalcFineNotEmpty; >+ >+use Modern::Perl; >+ >+use base qw(Koha::Plugins::Base); >+ >+our $VERSION = "0.0.1"; >+our $metadata = { >+ name => 'Calc Fine Not Empty Plugin', >+ author => 'Kyle M Hall', >+ description => 'Test plugin', >+ date_authored => '2013-01-14', >+ date_updated => '2013-01-14', >+ minimum_version => '3.11', >+ maximum_version => undef, >+ version => $VERSION, >+ namespace => 'calc_fine_not_empty', >+}; >+ >+sub new { >+ my ( $class, $args ) = @_; >+ $args->{'metadata'} = $metadata; >+ my $self = $class->SUPER::new($args); >+ return $self; >+} >+ >+sub overwrite_calc_fine { >+ my ( $self, $params ) = @_; >+ >+ return [ 1, 2, 3 ]; >+} >+ >+1; >-- >2.49.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 39405
:
179582
|
180095
|
180111
|
180127
|
180342
|
180343
|
180344
|
180433
|
180439
|
180440
|
180441
|
180442
|
180486
|
180505
|
180506
|
180507
|
180508