|
Lines 175-183
subtest 'disown_or_delete() tests' => sub {
Link Here
|
| 175 |
subtest 'ListOwnershipUponPatronDeletion set to transfer_public' => sub { |
175 |
subtest 'ListOwnershipUponPatronDeletion set to transfer_public' => sub { |
| 176 |
plan tests => 2; |
176 |
plan tests => 2; |
| 177 |
$schema->storage->txn_begin; |
177 |
$schema->storage->txn_begin; |
| 178 |
my $patron_1 = $builder->build_object( { class => 'Koha::Patrons' } ); |
178 |
my $patron_1 = $builder->build_object( { class => 'Koha::Patrons' } ); |
| 179 |
my $patron_2 = $builder->build_object( { class => 'Koha::Patrons' } ); |
179 |
my $patron_2 = $builder->build_object( { class => 'Koha::Patrons' } ); |
| 180 |
my $patron_3 = $builder->build_object( { class => 'Koha::Patrons' } ); |
180 |
my $patron_3 = $builder->build_object( { class => 'Koha::Patrons' } ); |
| 181 |
my $public_list = $builder->build_object( |
181 |
my $public_list = $builder->build_object( |
| 182 |
{ |
182 |
{ |
| 183 |
class => "Koha::Virtualshelves", |
183 |
class => "Koha::Virtualshelves", |
|
Lines 201-213
subtest 'disown_or_delete() tests' => sub {
Link Here
|
| 201 |
t::lib::Mocks::mock_preference( 'ListOwnershipUponPatronDeletion', 'transfer_public' ); |
201 |
t::lib::Mocks::mock_preference( 'ListOwnershipUponPatronDeletion', 'transfer_public' ); |
| 202 |
t::lib::Mocks::mock_preference( 'ListOwnerDesignated', $patron_3->id ); |
202 |
t::lib::Mocks::mock_preference( 'ListOwnerDesignated', $patron_3->id ); |
| 203 |
|
203 |
|
| 204 |
my $rs = Koha::Virtualshelves->search( |
204 |
my $rs = Koha::Virtualshelves->search( { shelfnumber => [ $public_list->id, $private_list_shared->id ] } ); |
| 205 |
{ shelfnumber => [ $public_list->id, $private_list_shared->id ] } ); |
|
|
| 206 |
|
205 |
|
| 207 |
my $result = $rs->disown_or_delete; |
206 |
my $result = $rs->disown_or_delete; |
| 208 |
$rs->reset; |
207 |
$rs->reset; |
| 209 |
|
208 |
|
| 210 |
is( $rs->count, 1, 'Only public list should be transferred' ); |
209 |
is( $rs->count, 1, 'Only public list should be transferred' ); |
| 211 |
is( $rs->next->id, $public_list->id, 'Check id too' ); |
210 |
is( $rs->next->id, $public_list->id, 'Check id too' ); |
| 212 |
|
211 |
|
| 213 |
$schema->storage->txn_rollback; |
212 |
$schema->storage->txn_rollback; |
| 214 |
- |
|
|