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

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

Return to bug 39145