Preliminary work on marc21_field_008.pl and 008_authorities.pl. Moving $dateentered en $defaultval to lower scope level. date_entered is a new sub (in a module); sub Field008 has been reduced to one line. Added a trivial unit test for date_entered. Note: the format used in date_entered could be added in DateUtils, moving this logic to a better place. Test plan: Use both plugins in the marc21 editor (biblios/authorities). Run the adjusted unit test. Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Both plugins works, no errors Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
16 lines
503 B
Raku
Executable file
16 lines
503 B
Raku
Executable file
#!/usr/bin/perl
|
|
|
|
use Modern::Perl;
|
|
use Test::More tests => 7;
|
|
|
|
use_ok( 'Koha::Util::FrameworkPlugin', qw(wrapper date_entered) );
|
|
|
|
my $char;
|
|
is($char=wrapper(' '),'space',"Return space");
|
|
is($char=wrapper(' '),'dblspace',"Return dblspace");
|
|
is($char=wrapper('|'),'pipe',"Return pipe");
|
|
is($char=wrapper('||'),'dblpipe',"Return dblpipe");
|
|
is($char=wrapper('somethingelse'),'somethingelse',"Return somethingelse");
|
|
|
|
my $f008= date_entered();
|
|
is( $f008 =~ /^\d{6}$/, 1, 'date_entered gives six digits' );
|