Bug 34776: Unit tests

Just a small beginning..

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 6cc683b518)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
Marcel de Rooy 2025-04-23 17:08:11 +02:00 committed by Paul Derscheid
parent 8d496f1bed
commit 3b031ce510
No known key found for this signature in database
GPG Key ID: C25F9FD44CED595B
1 changed files with 21 additions and 10 deletions

View File

@ -1,15 +1,26 @@
#!/usr/bin/perl
#
# This Koha test module is a stub!
# Add more tests here!!!
use strict;
use warnings;
use Modern::Perl;
use CGI;
use Template;
use Test::NoWarnings;
use Test::More tests => 2;
use Test::More tests => 1;
use Test::MockModule;
#use Test::NoWarnings;
BEGIN {
use_ok('C4::Form::MessagingPreferences');
}
use C4::Form::MessagingPreferences;
subtest 'restore_values' => sub {
plan tests => 1;
my $cgi = CGI->new;
my $template_module = Test::MockModule->new( 'Template' );
my $vars = {};
$template_module->mock( 'param', sub { my ( $self, $key, $val ) = @_; $vars->{$key} = $val; } );
my $template = Template->new( ENCODING => 'UTF-8' );
C4::Form::MessagingPreferences::restore_form_values( $cgi, $template );
require Data::Dumper; warn Data::Dumper::Dumper( $vars ); #FIXME Remove debugging
# TODO Add some checking on $vars->{messaging_preferences} here
ok(1); # FIXME Replace
};