View | Details | Raw Unified | Return to bug 35331
Collapse All | Expand All

(-)a/t/db_dependent/Koha/Plugins/Ill_hooks.t (+73 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it under the
6
# terms of the GNU General Public License as published by the Free Software
7
# Foundation; either version 3 of the License, or (at your option) any later
8
# version.
9
#
10
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License along
15
# with Koha; if not, see <http://www.gnu.org/licenses>.
16
17
use Modern::Perl;
18
use File::Basename;
19
use Test::More tests => 4;
20
21
use t::lib::Mocks;
22
use t::lib::TestBuilder;
23
24
use Koha::Database;
25
26
BEGIN {
27
    # Mock pluginsdir before loading Plugins module
28
    my $path = dirname(__FILE__) . '/../../../lib/plugins';
29
    t::lib::Mocks::mock_config( 'pluginsdir', $path );
30
31
    use_ok('Koha::Plugins');
32
    use_ok('Koha::Plugins::Handler');
33
    use_ok('Koha::Plugin::Test');
34
}
35
36
my $schema  = Koha::Database->new->schema;
37
my $builder = t::lib::TestBuilder->new;
38
39
t::lib::Mocks::mock_config( 'enable_plugins', 1 );
40
41
subtest 'ill_table_actions hook' => sub {
42
43
    plan tests => 1;
44
45
    $schema->storage->txn_begin;
46
47
    my $plugins = Koha::Plugins->new;
48
    $plugins->InstallPlugins;
49
50
    my $table_actions = Koha::Illrequest->get_staff_table_actions;
51
52
    is_deeply(
53
        $table_actions,
54
        [
55
            {
56
                button_class                  => 'btn btn-default btn-sm',
57
                button_link                   => '/cgi-bin/koha/ill/ill-requests.pl?method=illview&amp;illrequest_id=',
58
                append_column_data_to_link    => 1,
59
                button_link_translatable_text => 'ill_manage'
60
            },
61
            {
62
                button_link_text           => 'Test text',
63
                append_column_data_to_link => 1,
64
                button_class               => 'test class',
65
                button_link                => 'test link'
66
            }
67
        ],
68
        'get_staff_table_actions() should return core action plus a custom plugin actions'
69
    );
70
71
    Koha::Plugins::Methods->delete;
72
    $schema->storage->txn_rollback;
73
};
(-)a/t/lib/plugins/Koha/Plugin/Test.pm (-1 / +11 lines)
Lines 369-374 sub after_recall_action { Link Here
369
        "after_recall_action called with action: $action, ref: " . ref($recall) );
369
        "after_recall_action called with action: $action, ref: " . ref($recall) );
370
}
370
}
371
371
372
sub ill_table_actions {
373
    my ( $self ) = @_;
374
375
    return {
376
        button_link_text           => 'Test text',
377
        append_column_data_to_link => 1,
378
        button_class               => 'test class',
379
        button_link                => 'test link'
380
    };
381
}
382
372
sub _private_sub {
383
sub _private_sub {
373
    return "";
384
    return "";
374
}
385
}
375
- 

Return to bug 35331