Bug 37316: Add tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 7b4bdf286c)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Lucas Gass 2024-07-11 17:16:32 +00:00
parent 3986061572
commit 9a50edfa7f
1 changed files with 24 additions and 1 deletions

View File

@ -20,7 +20,7 @@
use Modern::Perl;
use utf8;
use Test::More tests => 34;
use Test::More tests => 35;
use Test::Exception;
use Test::MockModule;
@ -843,6 +843,29 @@ subtest 'request_transfer' => sub {
$schema->storage->txn_rollback;
};
subtest 'store check barcodes' => sub {
plan tests => 3;
$schema->storage->txn_begin;
my $biblio = $builder->build_sample_biblio();
my $item = $builder->build_sample_item(
{
biblionumber => $biblio->biblionumber,
}
);
$item->barcode("")->store();
is( $item->barcode, undef, 'Empty string barcodes are treated as undef');
$item->barcode("123456789")->store();
is( $item->barcode, "123456789", 'Non-empty string barcodes are unchanged');
$item->barcode(undef)->store();
is( $item->barcode, undef, 'undef barcodes remain undef');
};
subtest 'deletion' => sub {
plan tests => 15;