From bfae68c2b768a746538393ea1bf0171d8e1ed13d Mon Sep 17 00:00:00 2001
From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Date: Tue, 31 Jan 2017 09:11:05 +0100
Subject: [PATCH] Bug 18014: Add test to AuthoritiesMarc.t to expose problem in
 AddAuthority
Content-Type: text/plain; charset=utf-8

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
---
 t/db_dependent/AuthoritiesMarc.t | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/t/db_dependent/AuthoritiesMarc.t b/t/db_dependent/AuthoritiesMarc.t
index da8241d..02e5563 100755
--- a/t/db_dependent/AuthoritiesMarc.t
+++ b/t/db_dependent/AuthoritiesMarc.t
@@ -5,7 +5,7 @@
 
 use Modern::Perl;
 
-use Test::More tests => 8;
+use Test::More tests => 9;
 use Test::MockModule;
 use Test::Warn;
 use MARC::Record;
@@ -191,4 +191,16 @@ is_deeply(
     'test BuildSummary for UNIMARC'
 );
 
+subtest 'AddAuthority should respect AUTO_INCREMENT (BZ 18104)' => sub {
+    plan tests => 1;
+
+    t::lib::Mocks::mock_preference( 'marcflavour', 'MARC21' );
+    my $record = C4::AuthoritiesMarc::GetAuthority(1);
+    my $id1 = AddAuthority( $record, undef, 'GEOGR_NAME' );
+    DelAuthority( $id1 );
+    my $id2 = AddAuthority( $record, undef, 'GEOGR_NAME' );
+    is( $id1, $id2, 'FIXME: Got the same id back, let\'s fix that behavior' );
+    
+};
+
 $schema->storage->txn_rollback;
-- 
2.1.4