Bug 22709: (RM follow-up) AddBiblio returns a list not a scalar
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 15 Jul 2019 11:37:42 +0000 (12:37 +0100)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 15 Jul 2019 11:43:17 +0000 (12:43 +0100)
AddBiblio was being called in scalar context in
Biblio_and_Items_plugin_hooks.t and this was leading to difficult to
reproduce test failures. If the tests was run after any other test that
also called AddBiblio then it would fail, but if it was run as the first
test it would pass. This is due to a fluke in processing which meant the
the final return value of the list (itemnumber) happened to match a
biblionumber.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

t/db_dependent/Koha/Plugins/Biblio_and_Items_plugin_hooks.t

index 3a89ba1..99dacec 100755 (executable)
@@ -55,7 +55,7 @@ subtest 'after_biblio_action() and after_item_action() hooks tests' => sub {
 
     my $biblio_id;
 
-    warning_like { $biblio_id = C4::Biblio::AddBiblio( MARC::Record->new(), '' ); }
+    warning_like { ( $biblio_id, undef ) = C4::Biblio::AddBiblio( MARC::Record->new(), '' ); }
             qr/after_biblio_action called with action: create, ref: Koha::Biblio/,
             'AddBiblio calls the hook with action=create';