Bugzilla – Attachment 160469 Details for
Bug 33036
Add route to merge bibliographic records
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33036: Improve merge_with tests
Bug-33036-Improve-mergewith-tests.patch (text/plain), 3.24 KB, created by
Jonathan Druart
on 2024-01-03 14:54:26 UTC
(
hide
)
Description:
Bug 33036: Improve merge_with tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2024-01-03 14:54:26 UTC
Size:
3.24 KB
patch
obsolete
>From 29128c77e6e28d1e042caaee0ba045800a0cbbb7 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 14 Dec 2023 10:00:25 +0100 >Subject: [PATCH] Bug 33036: Improve merge_with tests > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > t/db_dependent/Koha/Biblio.t | 39 ++++++++++++++++-------------------- > 1 file changed, 17 insertions(+), 22 deletions(-) > >diff --git a/t/db_dependent/Koha/Biblio.t b/t/db_dependent/Koha/Biblio.t >index b338c86fee8..f95ffc5525d 100755 >--- a/t/db_dependent/Koha/Biblio.t >+++ b/t/db_dependent/Koha/Biblio.t >@@ -487,38 +487,33 @@ subtest 'to_api() tests' => sub { > }; > > subtest 'merge of records' => sub { >- plan tests => 3; >+ plan tests => 9; > $schema->storage->txn_begin; > >- #Three biblio >- my $biblio1 = $builder->build_sample_biblio( { title => 'Title number 1' } ); >- my $biblio2 = $builder->build_sample_biblio( { title => 'Title number 2' } ); >- my $biblio3 = $builder->build_sample_biblio( { title => 'Title number 3' } ); >+ # 3 items from 3 different biblio records >+ my $item1 = $builder->build_sample_item; >+ my $item2 = $builder->build_sample_item; >+ my $item3 = $builder->build_sample_item; > >- # One items each >- my $item1_1 = $builder->build_sample_item( { biblionumber => $biblio1->biblionumber, barcode => 'bar11' } ); >- my $item2_1 = $builder->build_sample_item( { biblionumber => $biblio2->biblionumber, barcode => 'bar22' } ); >- my $item3_1 = $builder->build_sample_item( { biblionumber => $biblio3->biblionumber, barcode => 'bar33' } ); >- my $results = ''; >- my @to_merge = ( $biblio2->biblionumber, $biblio3->biblionumber ); >+ my $biblio1 = $item1->biblio; >+ my $biblio2 = $item2->biblio; >+ my $biblio3 = $item3->biblio; > > my $pre_merged_rs = Koha::Biblios->search( > { biblionumber => [ $biblio1->biblionumber, $biblio2->biblionumber, $biblio3->biblionumber ] } ); > is( $pre_merged_rs->count, 3, '3 biblios exist' ); > >- eval { $results = $biblio1->merge_with( \@to_merge ); }; >- if ($@) { >- is( 0, 1, "Not working. Error: " . $@ ); >- } else { >- my $items = $biblio1->items; >- is( $items->count, 3, "After merge we have 3 items on first record" ); >+ warning_like { $biblio1->merge_with( [ $biblio2->biblionumber, $biblio3->biblionumber ] ) } q{}; >+ is( $biblio1->items->count, 3, "After merge we have 3 items on first record" ); > >- my $merged_rs = Koha::Biblios->search( >- { biblionumber => [ $biblio1->biblionumber, $biblio2->biblionumber, $biblio3->biblionumber ] } ); >- is( $merged_rs->count, 1, 'only 1 biblio left, the merged ones are gone' ); >- } >+ is( ref( $biblio1->get_from_storage ), 'Koha::Biblio', 'biblio record 1 still exists' ); >+ is( $biblio2->get_from_storage, undef, 'biblio record 2 no longer exists' ); >+ is( $biblio3->get_from_storage, undef, 'biblio record 3 no longer exists' ); >+ >+ is( $item1->get_from_storage->biblionumber, $biblio1->biblionumber ); >+ is( $item2->get_from_storage->biblionumber, $biblio1->biblionumber ); >+ is( $item3->get_from_storage->biblionumber, $biblio1->biblionumber ); > >- #End work > $schema->storage->txn_rollback; > }; > >-- >2.34.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 33036
:
152436
|
152437
|
152438
|
152439
|
152440
|
152447
|
152472
|
152659
|
152678
|
157481
|
157482
|
157731
|
159011
|
159012
|
159103
|
159120
|
159191
|
159239
|
159826
|
159827
|
159828
|
159829
|
160302
|
160468
| 160469 |
160470
|
160471
|
160472