Bugzilla – Attachment 172395 Details for
Bug 38093
Bundles: Add MARC link options should also add a link in 462
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38093: Add unit tests
Bug-38093-Add-unit-tests.patch (text/plain), 4.86 KB, created by
Baptiste Wojtkowski (bwoj)
on 2024-10-04 13:06:05 UTC
(
hide
)
Description:
Bug 38093: Add unit tests
Filename:
MIME Type:
Creator:
Baptiste Wojtkowski (bwoj)
Created:
2024-10-04 13:06:05 UTC
Size:
4.86 KB
patch
obsolete
>From de18c3c01b57a5941d5541dfbb964b1904216127 Mon Sep 17 00:00:00 2001 >From: Baptiste Wojtkowski <bski@laposte.net> >Date: Fri, 4 Oct 2024 14:22:05 +0200 >Subject: [PATCH] Bug 38093: Add unit tests > >--- > t/db_dependent/Koha/Biblio.t | 115 +++++++++++++++++++++++++++++++++++ > 1 file changed, 115 insertions(+) > >diff --git a/t/db_dependent/Koha/Biblio.t b/t/db_dependent/Koha/Biblio.t >index 6af083b2..e08ec026 100755 >--- a/t/db_dependent/Koha/Biblio.t >+++ b/t/db_dependent/Koha/Biblio.t >@@ -1062,6 +1062,121 @@ subtest 'link_marc_host' => sub { > $schema->storage->txn_rollback; > }; > >+subtest 'link_marc_bundled_item' => sub { >+ plan tests => 4; >+ $schema->storage->txn_begin; >+ >+ my $child = $builder->build_sample_item(); >+ >+ my $host = $builder->build_sample_biblio(); >+ my $host_record = $host->metadata->record; >+ >+ is( $host_record->field('774'), undef, "774 field is undefined before link_marc_bundled_item" ); >+ $host->link_marc_bundled_item( { bundled_item => $child->itemnumber } ); >+ $host->discard_changes; >+ $host_record = $host->metadata->record; >+ is( >+ ref( $host_record->field('774') ), 'MARC::Field', >+ '774 field is set after calling link_marc_bundled_item({ bundled_item => $itemnumber })' >+ ); >+ >+ $host = $builder->build_sample_biblio(); >+ $host_record = $host->metadata->record; >+ is( $host_record->field('774'), undef, "774 field is undefined before link_marc_bundled_item" ); >+ $host->link_marc_bundled_item( { bundled_item => $child } ); >+ $host->discard_changes; >+ $host_record = $host->metadata->record; >+ is( >+ ref( $host_record->field('774') ), 'MARC::Field', >+ '774 field is set after calling link_marc_bundled_item({ bundled_item => $biblio })' >+ ); >+ >+ $schema->storage->txn_rollback; >+}; >+ >+subtest 'unlink_marc_bundled_item' => sub { >+ plan tests => 8; >+ $schema->storage->txn_begin; >+ my $child = $builder->build_sample_item(); >+ my $wrongchild = $builder->build_sample_item(); >+ my $host = $builder->build_sample_biblio(); >+ my $host_record = $host->metadata->record; >+ >+ # Prepare the environment >+ $host->link_marc_bundled_item( { bundled_item => $child->itemnumber } ); >+ $host->discard_changes; >+ $host_record = $host->metadata->record; >+ is( >+ ref( $host_record->field('774') ), 'MARC::Field', >+ '774 field is set before calling unlink_marc_bundled_item({ bundled_item => $itemnumber })' >+ ); >+ >+ # Test >+ $host->unlink_marc_bundled_item( { bundled_item => $child->itemnumber } ); >+ $host->discard_changes; >+ $host_record = $host->metadata->record; >+ is( >+ $host_record->field('774'), undef, >+ 'Can remove a link to a bundle using a itemnumber to identify the bundle' >+ ); >+ >+ # Prepare the environment >+ $host->link_marc_bundled_item( { bundled_item => $child->itemnumber } ); >+ $host->discard_changes; >+ $host_record = $host->metadata->record; >+ is( >+ ref( $host_record->field('774') ), 'MARC::Field', >+ '774 field is set before calling unlink_marc_bundled_item({ bundled_item => $itemnumber })' >+ ); >+ >+ # Test >+ $host->unlink_marc_bundled_item( { bundled_item => $child } ); >+ $host->discard_changes; >+ $host_record = $host->metadata->record; >+ is( >+ $host_record->field('774'), undef, >+ 'Can remove a link to a bundle using a record to identify the bundle' >+ ); >+ >+ # Prepare the environment >+ $host->link_marc_bundled_item( { bundled_item => $child->itemnumber } ); >+ $host->discard_changes; >+ $host_record = $host->metadata->record; >+ is( >+ ref( $host_record->field('774') ), 'MARC::Field', >+ '774 field is set before calling unlink_marc_bundled_item({ bundled_item => $itemnumber })' >+ ); >+ >+ # Test >+ $host->unlink_marc_bundled_item( { bundled_item => $wrongchild->itemnumber } ); >+ $host->discard_changes; >+ $host_record = $host->metadata->record; >+ is( >+ ref( $host_record->field('774') ), 'MARC::Field', >+ 'Removing a link from another bundle does not remove the field' >+ ); >+ >+ # Prepare the environment >+ $host->link_marc_bundled_item( { bundled_item => $child->itemnumber } ); >+ $host->discard_changes; >+ $host_record = $host->metadata->record; >+ is( >+ ref( $host_record->field('774') ), 'MARC::Field', >+ '774 field is set before calling unlink_marc_bundled_item({ bundled_item => $itemnumber })' >+ ); >+ >+ # Test >+ $host->unlink_marc_bundled_item( { bundled_item => $wrongchild } ); >+ $host->discard_changes; >+ $host_record = $host->metadata->record; >+ is( >+ ref( $host_record->field('774') ), 'MARC::Field', >+ 'Removing a link from another bundle does not remove the field' >+ ); >+ >+ $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 38093
: 172395 |
172396
|
172397