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

(-)a/t/db_dependent/Koha/Biblios.t (-10 / +11 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 4;
22
use Test::More tests => 5;
23
use Test::Exception;
23
24
24
use C4::Biblio;
25
use C4::Biblio;
25
use C4::Items;
26
use C4::Items;
Lines 184-198 subtest 'can_be_transferred' => sub { Link Here
184
    is($biblio->can_be_transferred({ to => $library2 }), 0, 'Given all of items'
185
    is($biblio->can_be_transferred({ to => $library2 }), 0, 'Given all of items'
185
        .' of the biblio are from same, transfer limited library, then transfer'
186
        .' of the biblio are from same, transfer limited library, then transfer'
186
        .' is not possible.');
187
        .' is not possible.');
187
    eval { $biblio->can_be_transferred({ to => undef }); };
188
    throws_ok { $biblio->can_be_transferred({ to => undef }); }
188
    is(ref($@), 'Koha::Exceptions::Library::NotFound', 'Exception thrown when no'
189
              'Koha::Exceptions::Library::NotFound',
189
        .' library given.');
190
              'Exception thrown when no library given.';
190
    eval { $biblio->can_be_transferred({ to => 'heaven' }); };
191
    throws_ok { $biblio->can_be_transferred({ to => 'heaven' }); }
191
    is(ref($@), 'Koha::Exceptions::Library::NotFound', 'Exception thrown when'
192
              'Koha::Exceptions::Library::NotFound',
192
        .' invalid library is given.');
193
              'Exception thrown when invalid library is given.';
193
    eval { $biblio->can_be_transferred({ to => $library2, from => 'hell' }); };
194
    throws_ok { $biblio->can_be_transferred({ to => $library2, from => 'hell' }); }
194
    is(ref($@), 'Koha::Exceptions::Library::NotFound', 'Exception thrown when'
195
              'Koha::Exceptions::Library::NotFound',
195
        .' invalid library is given.');
196
              'Exception thrown when invalid library is given.';
196
};
197
};
197
198
198
$schema->storage->txn_rollback;
199
$schema->storage->txn_rollback;
(-)a/t/db_dependent/Koha/Items.t (-8 / +11 lines)
Lines 20-25 Link Here
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 9;
22
use Test::More tests => 9;
23
use Test::Exception;
23
24
24
use C4::Circulation;
25
use C4::Circulation;
25
use Koha::Item;
26
use Koha::Item;
Lines 156-169 subtest 'can_be_transferred' => sub { Link Here
156
    })->count, 1, 'Given we have added a transfer limit,');
157
    })->count, 1, 'Given we have added a transfer limit,');
157
    is($item->can_be_transferred({ to => $library2 }), 0,
158
    is($item->can_be_transferred({ to => $library2 }), 0,
158
       'Item can no longer be transferred between libraries.');
159
       'Item can no longer be transferred between libraries.');
159
    is($item->can_be_transferred({ to => $library2, $library1 }), 0,
160
    is($item->can_be_transferred({ to => $library2, from => $library1 }), 0,
160
       'We get the same result also if we pass the from-library parameter.');
161
       'We get the same result also if we pass the from-library parameter.');
161
    eval { $item->can_be_transferred({ to => undef }); };
162
    throws_ok { $item->can_be_transferred({ to => undef }); }
162
    is(ref($@), 'Koha::Exceptions::Library::NotFound', 'Exception thrown when no library given.');
163
              'Koha::Exceptions::Library::NotFound',
163
    eval { $item->can_be_transferred({ to => 'heaven' }); };
164
              'Exception thrown when no library given.';
164
    is(ref($@), 'Koha::Exceptions::Library::NotFound', 'Exception thrown when invalid library is given.');
165
    throws_ok { $item->can_be_transferred({ to => 'heaven' }); }
165
    eval { $item->can_be_transferred({ to => $library2, from => 'hell' }); };
166
              'Koha::Exceptions::Library::NotFound',
166
    is(ref($@), 'Koha::Exceptions::Library::NotFound', 'Exception thrown when invalid library is given.');
167
              'Exception thrown when invalid library is given.';
168
    throws_ok { $item->can_be_transferred({ to => $library2, from => 'hell' }); }
169
              'Koha::Exceptions::Library::NotFound',
170
              'Exception thrown when invalid library is given.';
167
};
171
};
168
172
169
$retrieved_item_1->delete;
173
$retrieved_item_1->delete;
170
- 

Return to bug 18072