Bugzilla – Attachment 151022 Details for
Bug 28328
Editing a record can cause an ISE if data too long for column
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28328: Adjust tests
Bug-28328-Adjust-tests.patch (text/plain), 3.16 KB, created by
Martin Renvoize (ashimema)
on 2023-05-10 16:10:39 UTC
(
hide
)
Description:
Bug 28328: Adjust tests
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2023-05-10 16:10:39 UTC
Size:
3.16 KB
patch
obsolete
>From 56169ca07201b83aed050d33cb74c0f5c1f654ee Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 3 May 2023 15:42:15 +0200 >Subject: [PATCH] Bug 28328: Adjust tests > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > t/db_dependent/Biblio.t | 33 +++++++++++++++++++++++++-------- > 1 file changed, 25 insertions(+), 8 deletions(-) > >diff --git a/t/db_dependent/Biblio.t b/t/db_dependent/Biblio.t >index 99310eb6a2..3d6f96e759 100755 >--- a/t/db_dependent/Biblio.t >+++ b/t/db_dependent/Biblio.t >@@ -44,22 +44,22 @@ Koha::Caches->get_instance->clear_from_cache( "MarcSubfieldStructure-" ); > my $builder = t::lib::TestBuilder->new; > > subtest 'AddBiblio' => sub { >- plan tests => 5; >+ plan tests => 9; > > my $marcflavour = 'MARC21'; > t::lib::Mocks::mock_preference( 'marcflavour', $marcflavour ); >- my $record = MARC::Record->new(); > >- my ( $f, $sf ) = GetMarcFromKohaField('biblioitems.lccn'); >- my $lccn_field = MARC::Field->new( $f, ' ', ' ', >- $sf => 'ThisisgoingtobetoomanycharactersfortheLCCNfield' ); >- $record->append_fields($lccn_field); >+ my ( $f, $sf ) = GetMarcFromKohaField('biblioitems.cn_item'); >+ my $cn_item_field = MARC::Field->new( $f, ' ', ' ', >+ $sf => 'Thisisgoingtobetoomanycharactersforthe.cn_item.field' ); >+ my $record = MARC::Record->new(); >+ $record->append_fields($cn_item_field); > > my $nb_biblios = Koha::Biblios->count; > my ( $biblionumber, $biblioitemnumber ); > warnings_like { ( $biblionumber, $biblioitemnumber ) = C4::Biblio::AddBiblio( $record, '' ) } >- [ qr/Data too long for column 'lccn'/, qr/Data too long for column 'lccn'/ ], >- "expected warnings when adding too long LCCN"; >+ [ qr/Data too long for column 'cn_item'/, qr/Data too long for column 'cn_item'/ ], >+ "expected warnings when adding too long cn_item"; > is( $biblionumber, undef, > 'AddBiblio returns undef for biblionumber if something went wrong' ); > is( $biblioitemnumber, undef, >@@ -68,6 +68,23 @@ subtest 'AddBiblio' => sub { > is( Koha::Biblios->count, $nb_biblios, > 'No biblio should have been added if something went wrong' ); > >+ ( $f, $sf ) = GetMarcFromKohaField('biblioitems.lccn'); >+ my $lccn_field = MARC::Field->new( $f, ' ', ' ', >+ $sf => 'ThisisNOTgoingtobetoomanycharactersfortheLCCNfield' ); >+ $record = MARC::Record->new(); >+ $record->append_fields($lccn_field); >+ >+ warnings_like { ( $biblionumber, $biblioitemnumber ) = C4::Biblio::AddBiblio( $record, '' ) } >+ [], >+ "No warning expected when adding a long LCCN"; >+ isnt( $biblionumber, undef, >+ 'AddBiblio returns the biblionumber' ); >+ isnt( $biblioitemnumber, undef, >+ 'AddBiblio returns the biblioitemnumber' >+ ); >+ is( Koha::Biblios->count, $nb_biblios + 1, >+ 'The biblio should have been added if nothing went wrong' ); >+ > t::lib::Mocks::mock_preference( 'AutoLinkBiblios', $marcflavour ); > t::lib::Mocks::mock_preference( 'AutoCreateAuthorities', $marcflavour ); > t::lib::Mocks::mock_preference( 'autoControlNumber', "OFF" ); >-- >2.40.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 28328
:
150583
|
150584
|
150585
|
150586
|
150587
|
150588
|
151020
|
151021
| 151022