View | Details | Raw Unified | Return to bug 39145
Collapse All | Expand All

(-)a/t/db_dependent/Koha/Virtualshelves.t (-2 / +42 lines)
Lines 31-37 my $builder = t::lib::TestBuilder->new; Link Here
31
31
32
subtest 'disown_or_delete() tests' => sub {
32
subtest 'disown_or_delete() tests' => sub {
33
33
34
    plan tests => 3;
34
    plan tests => 4;
35
35
36
    subtest 'All set cases' => sub {
36
    subtest 'All set cases' => sub {
37
37
Lines 172-177 subtest 'disown_or_delete() tests' => sub { Link Here
172
        $schema->storage->txn_rollback;
172
        $schema->storage->txn_rollback;
173
    };
173
    };
174
174
175
    subtest 'ListOwnershipUponPatronDeletion set to transfer_public' => sub {
176
        plan tests => 2;
177
        $schema->storage->txn_begin;
178
        my $patron_1 = $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' } );
181
        my $public_list = $builder->build_object(
182
            {
183
                class => "Koha::Virtualshelves",
184
                value => { owner => $patron_1->id, public => 1 }
185
            }
186
        );
187
        my $private_list_shared = $builder->build_object(
188
            {
189
                class => "Koha::Virtualshelves",
190
                value => { owner => $patron_1->id, public => 0 }
191
            }
192
        );
193
        $builder->build_object(
194
            {
195
                class => 'Koha::Virtualshelfshares',
196
                value =>
197
                    { shelfnumber => $private_list_shared->id, invitekey => undef, borrowernumber => $patron_2->id }
198
            }
199
        );
200
201
        t::lib::Mocks::mock_preference( 'ListOwnershipUponPatronDeletion', 'transfer_public' );
202
        t::lib::Mocks::mock_preference( 'ListOwnerDesignated',             $patron_3->id );
203
204
        my $rs = Koha::Virtualshelves->search(
205
            { shelfnumber => [ $public_list->id, $private_list_shared->id ] } );
206
207
        my $result = $rs->disown_or_delete;
208
        $rs->reset;
209
210
        is( $rs->count, 1, 'Only public list should be transferred' );
211
        is( $rs->next->id, $public_list->id, 'Check id too' );
212
213
        $schema->storage->txn_rollback;
214
    };
215
175
    subtest 'ListOwnershipUponPatronDeletion set to delete' => sub {
216
    subtest 'ListOwnershipUponPatronDeletion set to delete' => sub {
176
217
177
        plan tests => 2;
218
        plan tests => 2;
178
- 

Return to bug 39145