http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13940 --- Comment #6 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Comment on attachment 37454 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=37454 [PASSED QA] Bug 13940 : Testing C4::OAI::Sets
+#Test to enter in the 'else' case of 'AddOAISet' line 280 +{ + my $dbi_st = Test::MockModule->new('DBI::st', no_auto => 1); # ref($sth) == 'DBI::st' + $dbi_st->mock('execute', sub { return 0; }); + + my $setWrong = { + 'spec' => 'specWrong', + 'name' => 'nameWrong', + }; + my $setWrong_id = AddOAISet($setWrong); + + DelOAISet($setWrong_id); +}
It seems to me that you forgot to actually test behaviour here. You are traversing that branch in the code, but still need to test for: - Side effects (no side effects should be tested if such was the case) - The code raises a warning. It whould be tested with a block like this: my $setWrong_id; warning_is ( $setWrong_id = AddOAISet($setWrong) ) 'AddOAISet failed', 'AddOAISet raises warning in XXX condition'; There's also another warning not being tested. You need to add use Test::Warn; for this purpose. I leave you the task to put the pieces together :-D -- You are receiving this mail because: You are watching all bug changes.