Bugzilla – Attachment 138542 Details for
Bug 31288
Check userenv in ->disown_or_delete
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31288: Regression tests
Bug-31288-Regression-tests.patch (text/plain), 2.14 KB, created by
Tomás Cohen Arazi
on 2022-08-03 14:45:02 UTC
(
hide
)
Description:
Bug 31288: Regression tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi
Created:
2022-08-03 14:45:02 UTC
Size:
2.14 KB
patch
obsolete
>From fa22219a1fcc253df64842e52ccdd4b3f28b3a03 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 3 Aug 2022 11:40:51 -0300 >Subject: [PATCH] Bug 31288: Regression tests > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/Koha/Virtualshelves.t | 20 +++++++++++++++++--- > 1 file changed, 17 insertions(+), 3 deletions(-) > >diff --git a/t/db_dependent/Koha/Virtualshelves.t b/t/db_dependent/Koha/Virtualshelves.t >index 9b39ebd5ae..20d2454c99 100755 >--- a/t/db_dependent/Koha/Virtualshelves.t >+++ b/t/db_dependent/Koha/Virtualshelves.t >@@ -94,7 +94,7 @@ subtest 'disown_or_delete() tests' => sub { > > subtest 'Fallback to userenv' => sub { > >- plan tests => 6; >+ plan tests => 7; > > $schema->storage->txn_begin; > >@@ -133,14 +133,28 @@ subtest 'disown_or_delete() tests' => sub { > > t::lib::Mocks::mock_preference( 'ListOwnershipUponPatronDeletion', 'transfer' ); > t::lib::Mocks::mock_preference( 'ListOwnerDesignated', undef ); >- t::lib::Mocks::mock_userenv({ patron => $patron_3 }); > >- my $rs = Koha::Virtualshelves->search( { shelfnumber => [ $public_list->id, $private_list->id, $private_list_shared->id ] } ); >+ my $public_list_to_delete = $builder->build_object( >+ { >+ class => "Koha::Virtualshelves", >+ value => { owner => $patron_1->id, public => 1 } >+ } >+ ); > >+ my $rs = Koha::Virtualshelves->search({ shelfnumber => $public_list_to_delete->id }); > my $result = $rs->disown_or_delete; > is( ref($result), 'Koha::Virtualshelves', 'Return type is correct' ); > $rs->reset; > >+ is( $rs->count, 0, 'ListOwnerDesignated and userenv not set yield deletion' ); >+ >+ t::lib::Mocks::mock_userenv({ patron => $patron_3 }); >+ >+ $rs = Koha::Virtualshelves->search( { shelfnumber => [ $public_list->id, $private_list->id, $private_list_shared->id ] } ); >+ >+ $rs->disown_or_delete; >+ $rs->reset; >+ > is( $rs->count, 2, 'The private/non-shared list was deleted' ); > my $first = $rs->next; > is( $first->id, $public_list->id ); >-- >2.37.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 31288
:
138525
|
138526
| 138542 |
138543