Bugzilla – Attachment 171933 Details for
Bug 37710
Remove the marc link when removing an item from a bundle
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37710: Add unit tests
Bug-37710-Add-unit-tests.patch (text/plain), 4.33 KB, created by
Baptiste Wojtkowski (bwoj)
on 2024-09-24 13:45:35 UTC
(
hide
)
Description:
Bug 37710: Add unit tests
Filename:
MIME Type:
Creator:
Baptiste Wojtkowski (bwoj)
Created:
2024-09-24 13:45:35 UTC
Size:
4.33 KB
patch
obsolete
>From ba515499cf678679dac41632adc90f5370765f07 Mon Sep 17 00:00:00 2001 >From: Baptiste Wojtkowski <bski@laposte.net> >Date: Tue, 24 Sep 2024 11:51:20 +0200 >Subject: [PATCH] Bug 37710: Add unit tests > >--- > t/db_dependent/Koha/Biblio.t | 104 ++++++++++++++++++++++++++++++++++- > 1 file changed, 103 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Biblio.t b/t/db_dependent/Koha/Biblio.t >index 6b0da1f9..06ea4fe5 100755 >--- a/t/db_dependent/Koha/Biblio.t >+++ b/t/db_dependent/Koha/Biblio.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 39; >+use Test::More tests => 40; > use Test::Exception; > use Test::Warn; > >@@ -1071,6 +1071,108 @@ subtest 'link_marc_host' => sub { > $schema->storage->txn_rollback; > }; > >+subtest 'unlink_marc_host' => sub { >+ plan tests => 9; >+ $schema->storage->txn_begin; >+ my $host = $builder->build_sample_biblio(); >+ my $wronghost = $builder->build_sample_biblio(); >+ my $child = $builder->build_sample_biblio(); >+ my $child_record = $child->metadata->record; >+ >+ # Prepare the environment >+ $child->link_marc_host( { host => $host->biblionumber } ); >+ $child->discard_changes; >+ $child_record = $child->metadata->record; >+ is( >+ ref( $child_record->field('773') ), 'MARC::Field', >+ '773 field is set before calling unlink_marc_host({ host => $biblionumber })' >+ ); >+ >+ # Test >+ $child->unlink_marc_host( { host => $host->biblionumber } ); >+ $child->discard_changes; >+ $child_record = $child->metadata->record; >+ is( >+ $child_record->field('773'), undef, >+ 'Can remove a link to a bundle using a biblionumber to identify the bundle' >+ ); >+ >+ # Prepare the environment >+ $child->link_marc_host( { host => $host->biblionumber } ); >+ $child->discard_changes; >+ $child_record = $child->metadata->record; >+ is( >+ ref( $child_record->field('773') ), 'MARC::Field', >+ '773 field is set before calling unlink_marc_host({ host => $biblionumber })' >+ ); >+ >+ # Test >+ $child->unlink_marc_host( { host => $host } ); >+ $child->discard_changes; >+ $child_record = $child->metadata->record; >+ is( >+ $child_record->field('773'), undef, >+ 'Can remove a link to a bundle using a record to identify the bundle' >+ ); >+ >+ # Prepare the environment >+ $child->link_marc_host( { host => $host->biblionumber } ); >+ $child->discard_changes; >+ $child_record = $child->metadata->record; >+ is( >+ ref( $child_record->field('773') ), 'MARC::Field', >+ '773 field is set before calling unlink_marc_host({ host => $biblionumber })' >+ ); >+ >+ # Test >+ $child->unlink_marc_host( { host => $wronghost->biblionumber } ); >+ $child->discard_changes; >+ $child_record = $child->metadata->record; >+ is( >+ ref( $child_record->field('773') ), 'MARC::Field', >+ 'Removing a link from another bundle does not remove the field' >+ ); >+ >+ # Prepare the environment >+ $child->link_marc_host( { host => $host->biblionumber } ); >+ $child->discard_changes; >+ $child_record = $child->metadata->record; >+ is( >+ ref( $child_record->field('773') ), 'MARC::Field', >+ '773 field is set before calling unlink_marc_host({ host => $biblionumber })' >+ ); >+ >+ # Test >+ $child->unlink_marc_host( { host => $wronghost } ); >+ $child->discard_changes; >+ $child_record = $child->metadata->record; >+ is( >+ ref( $child_record->field('773') ), 'MARC::Field', >+ 'Removing a link from another bundle does not remove the field' >+ ); >+ >+ # Prepare the environment >+ $child->link_marc_host( { host => $host->biblionumber } ); >+ $child->link_marc_host( { host => $host->biblionumber } ); >+ $child->discard_changes; >+ $child_record = $child->metadata->record; >+ my @fields = $child_record->field('773'); >+ my $fields_before = scalar @fields; >+ >+ # Test >+ $child->unlink_marc_host( { host => $host } ); >+ $child->discard_changes; >+ $child_record = $child->metadata->record; >+ @fields = $child_record->field('773'); >+ my $fields_after = scalar @fields; >+ is( >+ $fields_after, $fields_before - 1, >+ 'Removing a link only removes one link' >+ ); >+ >+ $schema->storage->txn_rollback; >+}; >+ > subtest '->orders, ->uncancelled_orders and ->acq_status tests' => sub { > > plan tests => 9; >-- >2.30.2
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 37710
:
171832
| 171933 |
171934