Bug 32804: (follow-up) Test that id's have not changed
authorNick Clemens <nick@bywatersolutions.com>
Fri, 3 Mar 2023 12:18:40 +0000 (12:18 +0000)
committerTomas Cohen Arazi <tomascohen@theke.io>
Fri, 17 Mar 2023 12:59:12 +0000 (09:59 -0300)
Rather than assuming biblionumber and biblioitemnumber are the same, we
should test that they have not changed form their original values

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
t/db_dependent/ImportBatch.t

index 704d4ac..74340b7 100755 (executable)
@@ -361,9 +361,11 @@ subtest "BatchCommitRecords overlay into framework" => sub {
 };
 
 subtest "Do not adjust biblionumber when replacing items during import" => sub {
-    plan tests => 6;
+    plan tests => 7;
 
     my $item1 = $builder->build_sample_item;
+    my $original_biblionumber = $item1->biblionumber;
+    my $original_biblioitemnumber = $item1->biblioitemnumber;
     my $item2 = $builder->build_sample_item;
 
     my $library = $builder->build_object({ class => 'Koha::Libraries' });
@@ -401,7 +403,8 @@ subtest "Do not adjust biblionumber when replacing items during import" => sub {
     is( $import_item->status, 'imported', 'Import was successful');
     is( $import_item->import_error, undef, 'No error was reported' );
 
-    is( $item1->biblionumber, $item1->biblioitemnumber, "Item's biblionumber and biblioitemnumber match" );
+    is( $item1->biblionumber, $original_biblionumber, "Item's biblionumber has not changed" );
+    is( $item1->biblionumber, $original_biblioitemnumber, "Item's biblioitemnumber has not changed" );
     is( $item1->homebranch, $library->branchcode, "Item was overlaid successfully" );
 };