Bugzilla – Attachment 182872 Details for
Bug 39145
Differentiate between deleting or transferring public and shared lists
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39145: Add unit tests
Bug-39145-Add-unit-tests.patch (text/plain), 2.71 KB, created by
David Nind
on 2025-05-31 03:15:50 UTC
(
hide
)
Description:
Bug 39145: Add unit tests
Filename:
MIME Type:
Creator:
David Nind
Created:
2025-05-31 03:15:50 UTC
Size:
2.71 KB
patch
obsolete
>From f311063d081ad24d9e831852fd9a09a87ef98de3 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Mon, 17 Feb 2025 10:56:18 +0000 >Subject: [PATCH] Bug 39145: Add unit tests > >Test plan: >Run t/db_dependent/Koha/Virtualshelves.t > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Signed-off-by: David Nind <david@davidnind.com> >--- > t/db_dependent/Koha/Virtualshelves.t | 43 +++++++++++++++++++++++++++- > 1 file changed, 42 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Virtualshelves.t b/t/db_dependent/Koha/Virtualshelves.t >index 48f1a0cd2c..6f6caae1bc 100755 >--- a/t/db_dependent/Koha/Virtualshelves.t >+++ b/t/db_dependent/Koha/Virtualshelves.t >@@ -31,7 +31,7 @@ my $builder = t::lib::TestBuilder->new; > > subtest 'disown_or_delete() tests' => sub { > >- plan tests => 3; >+ plan tests => 4; > > subtest 'All set cases' => sub { > >@@ -172,6 +172,47 @@ subtest 'disown_or_delete() tests' => sub { > $schema->storage->txn_rollback; > }; > >+ subtest 'ListOwnershipUponPatronDeletion set to transfer_public' => sub { >+ plan tests => 2; >+ $schema->storage->txn_begin; >+ my $patron_1 = $builder->build_object( { class => 'Koha::Patrons' } ); >+ my $patron_2 = $builder->build_object( { class => 'Koha::Patrons' } ); >+ my $patron_3 = $builder->build_object( { class => 'Koha::Patrons' } ); >+ my $public_list = $builder->build_object( >+ { >+ class => "Koha::Virtualshelves", >+ value => { owner => $patron_1->id, public => 1 } >+ } >+ ); >+ my $private_list_shared = $builder->build_object( >+ { >+ class => "Koha::Virtualshelves", >+ value => { owner => $patron_1->id, public => 0 } >+ } >+ ); >+ $builder->build_object( >+ { >+ class => 'Koha::Virtualshelfshares', >+ value => >+ { shelfnumber => $private_list_shared->id, invitekey => undef, borrowernumber => $patron_2->id } >+ } >+ ); >+ >+ t::lib::Mocks::mock_preference( 'ListOwnershipUponPatronDeletion', 'transfer_public' ); >+ t::lib::Mocks::mock_preference( 'ListOwnerDesignated', $patron_3->id ); >+ >+ my $rs = Koha::Virtualshelves->search( >+ { shelfnumber => [ $public_list->id, $private_list_shared->id ] } ); >+ >+ my $result = $rs->disown_or_delete; >+ $rs->reset; >+ >+ is( $rs->count, 1, 'Only public list should be transferred' ); >+ is( $rs->next->id, $public_list->id, 'Check id too' ); >+ >+ $schema->storage->txn_rollback; >+ }; >+ > subtest 'ListOwnershipUponPatronDeletion set to delete' => sub { > > plan tests => 2; >-- >2.39.5
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 39145
:
178136
|
178137
|
178138
|
182851
|
182870
|
182871
| 182872 |
182873