Bug 18014: Add test to AuthoritiesMarc.t to expose problem in AddAuthority
Since AddAuthority uses max(id)+1 logic to produce the next authid, authority id's will be reused when you delete the last record. This may be a source of problems and will be addressed on the next patch. This patch add a test to expose the problem. Test plan: [1] Run t/db_dependent/AuthoritiesMarc.t Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
parent
ac004aa63e
commit
24ac8392b3
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue