Bug 22709: Unit tests
[koha-equinox.git] / t / lib / Koha / Plugin / Test.pm
index f817438..e34b61d 100644 (file)
@@ -3,6 +3,7 @@ package Koha::Plugin::Test;
 ## It's good practice to use Modern::Perl
 use Modern::Perl;
 
+use Koha::Exceptions::Exception;
 use Mojo::JSON qw(decode_json);
 
 ## Required for all plugins
@@ -45,6 +46,16 @@ sub to_marc {
     return "Koha::Plugin::Test::to_marc";
 }
 
+sub intranet_catalog_biblio_enhancements_toolbar_button {
+    my ( $self, $args ) = @_;
+    return "Koha::Plugin::Test::intranet_catalog_biblio_enhancements_toolbar_button";
+}
+
+sub intranet_catalog_biblio_enhancements {
+    my ( $self, $args ) = @_;
+    return "Koha::Plugin::Test::intranet_catalog_biblio_enhancements";
+}
+
 sub opac_online_payment {
     my ( $self, $args ) = @_;
     return "Koha::Plugin::Test::opac_online_payment";
@@ -70,6 +81,16 @@ sub opac_js {
     return "Koha::Plugin::Test::opac_js";
 }
 
+sub intranet_head {
+    my ( $self, $args ) = @_;
+    return "Koha::Plugin::Test::intranet_head";
+}
+
+sub intranet_js {
+    my ( $self, $args ) = @_;
+    return "Koha::Plugin::Test::intranet_js";
+}
+
 sub configure {
     my ( $self, $args ) = @_;
     return "Koha::Plugin::Test::configure";;
@@ -80,6 +101,11 @@ sub install {
     return "Koha::Plugin::Test::install";
 }
 
+sub upgrade {
+    my ( $self, $args ) = @_;
+    return "Koha::Plugin::Test::upgrade";
+}
+
 sub uninstall {
     my ( $self, $args ) = @_;
     return "Koha::Plugin::Test::uninstall";
@@ -99,6 +125,35 @@ sub api_namespace {
     return "testplugin";
 }
 
+sub after_biblio_action {
+    my ( $self, $params ) = @_;
+    my $action    = $params->{action} // '';
+    my $biblio    = $params->{biblio};
+    my $biblio_id = $params->{biblio_id};
+
+    if ( $action ne 'delete' ) {
+        Koha::Exceptions::Exception->throw("after_biblio_action called with action: $action, ref: " . ref($biblio) );
+    }
+    else {
+        Koha::Exceptions::Exception->throw("after_biblio_action called with action: $action") if $biblio_id;
+    }
+}
+
+
+sub after_item_action {
+    my ( $self, $params ) = @_;
+    my $action  = $params->{action} // '';
+    my $item    = $params->{item};
+    my $item_id = $params->{item_id};
+
+    if ( $action ne 'delete' ) {
+        Koha::Exceptions::Exception->throw("after_item_action called with action: $action, ref: " . ref($item) );
+    }
+    else {
+        Koha::Exceptions::Exception->throw("after_item_action called with action: $action" ) if $item_id;
+    }
+}
+
 sub api_routes {
     my ( $self, $args ) = @_;
 
@@ -157,3 +212,7 @@ sub api_routes {
 
     return decode_json($spec);
 }
+
+sub _private_sub {
+    return "";
+}