From 51861c1c4fcebc9ae417e802fa221da7e9beb4de Mon Sep 17 00:00:00 2001 From: Julian FIOL Date: Thu, 9 Apr 2015 16:22:48 +0200 Subject: [PATCH] Bug 13940 : (QA followup) Add tests for the 2 warnings which was not tested --- t/db_dependent/OAI/Sets.t | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/t/db_dependent/OAI/Sets.t b/t/db_dependent/OAI/Sets.t index 07aa4d4..932e457 100644 --- a/t/db_dependent/OAI/Sets.t +++ b/t/db_dependent/OAI/Sets.t @@ -18,8 +18,9 @@ use Modern::Perl; use C4::Context; -use Test::More tests => 145; +use Test::More tests => 147; use Test::MockModule; +use Test::Warn; BEGIN { @@ -88,9 +89,12 @@ ok (!defined(AddOAISet($set_without_name)), 'AddOAISet without "name" field is u 'spec' => 'specWrong', 'name' => 'nameWrong', }; - my $setWrong_id = AddOAISet($setWrong); + my $setWrong_id; + warning_is { $setWrong_id = AddOAISet($setWrong) } + 'AddOAISet failed', + 'AddOAISet raises warning if there is a problem with SET spec or SET name'; - DelOAISet($setWrong_id); + ok(!defined $setWrong_id, '$setWrong_id is not defined'); } #Adding a Set without description @@ -197,8 +201,9 @@ my $new_set_without_id = { 'name' => 'nameNoSpec', 'descriptions' => ['descNoSpecNoName'], }; -ok (!defined(ModOAISet($new_set_without_id)), 'ModOAISet without "id" field is undef'); - +warning_is { ModOAISet($new_set_without_id) } + 'Set ID not defined, can\'t modify the set', + 'ModOAISet raises warning if Set ID is not defined'; my $new_set_without_spec_and_name = { 'id' => $set1_id, @@ -595,10 +600,6 @@ my @setsNotEq = CalcOAISetsBiblio($record); is_deeply(@setsNotEq, $setNotVH_id, 'The $record only belongs to $setNotVH'); -# - - - # ---------- Subs -------------------------------- -- 2.3.3