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

(-)a/t/db_dependent/Koha/Biblios.t (-9 / +10 lines)
Lines 20-25 Link Here
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 3;
22
use Test::More tests => 3;
23
use Test::Exception;
23
24
24
use C4::Biblio;
25
use C4::Biblio;
25
use C4::Items;
26
use C4::Items;
Lines 133-147 subtest 'can_be_transferred' => sub { Link Here
133
    is($biblio->can_be_transferred({ to => $library2 }), 0, 'Given all of items'
134
    is($biblio->can_be_transferred({ to => $library2 }), 0, 'Given all of items'
134
        .' of the biblio are from same, transfer limited library, then transfer'
135
        .' of the biblio are from same, transfer limited library, then transfer'
135
        .' is not possible.');
136
        .' is not possible.');
136
    eval { $biblio->can_be_transferred({ to => undef }); };
137
    throws_ok { $biblio->can_be_transferred({ to => undef }); }
137
    is(ref($@), 'Koha::Exceptions::Library::NotFound', 'Exception thrown when no'
138
              'Koha::Exceptions::Library::NotFound',
138
        .' library given.');
139
              'Exception thrown when no library given.';
139
    eval { $biblio->can_be_transferred({ to => 'heaven' }); };
140
    throws_ok { $biblio->can_be_transferred({ to => 'heaven' }); }
140
    is(ref($@), 'Koha::Exceptions::Library::NotFound', 'Exception thrown when'
141
              'Koha::Exceptions::Library::NotFound',
141
        .' invalid library is given.');
142
              'Exception thrown when invalid library is given.';
142
    eval { $biblio->can_be_transferred({ to => $library2, from => 'hell' }); };
143
    throws_ok { $biblio->can_be_transferred({ to => $library2, from => 'hell' }); }
143
    is(ref($@), 'Koha::Exceptions::Library::NotFound', 'Exception thrown when'
144
              'Koha::Exceptions::Library::NotFound',
144
        .' invalid library is given.');
145
              'Exception thrown when invalid library is given.';
145
};
146
};
146
147
147
$schema->storage->txn_rollback;
148
$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