From 21f148ffea9cd717014b0096c00200b68b91d400 Mon Sep 17 00:00:00 2001
From: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Date: Thu, 4 Mar 2021 09:42:23 +0100
Subject: [PATCH] Bug 27837: Prevent the tests to fail is the field is mapped

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
---
 t/db_dependent/Items.t | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/t/db_dependent/Items.t b/t/db_dependent/Items.t
index 4ab2e2dac6..ef4de8f20b 100755
--- a/t/db_dependent/Items.t
+++ b/t/db_dependent/Items.t
@@ -1040,6 +1040,15 @@ subtest 'ModItemFromMarc' => sub {
     subtest 'permanent_location' => sub {
         plan tests => 6;
 
+        # Make sure items.permanent_location is not mapped
+        Koha::MarcSubfieldStructures->search(
+            {
+                frameworkcode => q{},
+                kohafield     => 'items.permanent_location',
+            }
+        )->delete;
+        Koha::Caches->get_instance->clear_from_cache( "MarcSubfieldStructure-" );
+
         my $item = $builder->build_sample_item;
 
         # By default, setting location to something new should set permanent location to the same thing
@@ -1079,4 +1088,5 @@ subtest 'ModItemFromMarc' => sub {
     };
 
     $schema->storage->txn_rollback;
-};
+    Koha::Caches->get_instance->clear_from_cache( "MarcSubfieldStructure-" );
+}
-- 
2.20.1