From 95067118d4b3c51e333e85134bb504d9c9076105 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 19 Mar 2020 14:39:14 +0100 Subject: [PATCH] Bug 24903: Add tests for _handle_seqno Content-Type: text/plain; charset=utf-8 Trivial tests. Test plan: Run t/Serials/ModSerialStatus.t Signed-off-by: Marcel de Rooy --- t/Serials/ModSerialStatus.t | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 t/Serials/ModSerialStatus.t diff --git a/t/Serials/ModSerialStatus.t b/t/Serials/ModSerialStatus.t new file mode 100755 index 0000000000..afd7effcfb --- /dev/null +++ b/t/Serials/ModSerialStatus.t @@ -0,0 +1,38 @@ +#!/usr/bin/perl + +# Copyright 2020 Rijksmuseum +# +# 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 . + +# Testing private routine C4::Serials::_handle_seqno of ModSerialStatus + +use Modern::Perl; +use Data::Dumper qw/Dumper/; + +use Test::More tests => 8; + +use C4::Serials qw//; + +# Testing C4::Serials::_handle_seqno +my $list = '2017 (No. 8); 2017 (No. 9); 2017 (No. 10)'; +is( C4::Serials::_handle_seqno( '2017 (No. 8)', $list ), $list, 'Not added 8' ); +is( C4::Serials::_handle_seqno( '2017 (No. 9)', $list ), $list, 'Not added 9' ); +is( C4::Serials::_handle_seqno( '2017 (No. 10)', $list ), $list, 'Not added 10' ); +is( C4::Serials::_handle_seqno( '2017 (No. 11)', $list ), $list.'; 2017 (No. 11)', 'Added 11' ); +is( C4::Serials::_handle_seqno( '2017 (No. 7)', $list, 'REMOVE'), $list, 'Not removed 7' ); +is( C4::Serials::_handle_seqno( '2017 (No. 10)', $list, 'REMOVE') !~ /\(10\)/, 1, 'Removed 10' ); +is( C4::Serials::_handle_seqno( '2017 (No. 8)', $list, 'CHECK'), 1, 'Found 8' ); +is( C4::Serials::_handle_seqno( '2017 (No. 11)', $list, 'CHECK'), q{}, 'Not found 11' ); -- 2.11.0