Bug 42551: Add unit test
Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
This commit is contained in:
parent
9be8db9c8a
commit
e48c124ac3
|
|
@ -0,0 +1,47 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
# This file is part of Koha.
|
||||
#
|
||||
# Koha is free software; you can redistribute it and/or modify it under the
|
||||
# terms of the GNU General Public License as published by the Free Software
|
||||
# Foundation; either version 3 of the License, or (at your option) any later
|
||||
# version.
|
||||
#
|
||||
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along
|
||||
# with Koha; if not, see <https://www.gnu.org/licenses>.
|
||||
|
||||
use Modern::Perl;
|
||||
|
||||
use Test::More tests => 1;
|
||||
|
||||
use File::Spec;
|
||||
use FindBin qw( $Bin );
|
||||
use IPC::Cmd qw( run );
|
||||
|
||||
use C4::Context;
|
||||
|
||||
my $plugin_class = 'Koha::Plugin::1_CalcFineEmpty';
|
||||
my $plugins_lib = File::Spec->rel2abs("$Bin/../../../lib/plugins");
|
||||
my $plugin_file = "$plugins_lib/Koha/Plugin/1_CalcFineEmpty.pm";
|
||||
|
||||
my $dbh = C4::Context->dbh;
|
||||
$dbh->do(
|
||||
q{REPLACE INTO plugin_data (plugin_class, plugin_key, plugin_value) VALUES (?, '__ENABLED__', '1')},
|
||||
{}, $plugin_class
|
||||
);
|
||||
|
||||
my ( $success, undef, $full_buf ) = run(
|
||||
command => [ $^X, "-I$plugins_lib", '-c', $plugin_file ],
|
||||
timeout => 30,
|
||||
);
|
||||
|
||||
$dbh->do( 'DELETE FROM plugin_data WHERE plugin_class = ?', {}, $plugin_class );
|
||||
|
||||
ok(
|
||||
$success,
|
||||
'perl -c on an enabled plugin file does not trigger a C3 merge error'
|
||||
) or diag( join( '', @{ $full_buf // [] } ) );
|
||||
Loading…
Reference in New Issue