Lines 142-148
subtest 'can_be_transferred' => sub {
Link Here
|
142 |
fromBranch => $library1, |
142 |
fromBranch => $library1, |
143 |
toBranch => $library2, |
143 |
toBranch => $library2, |
144 |
})->count, 0, 'There are no transfer limits between libraries.'); |
144 |
})->count, 0, 'There are no transfer limits between libraries.'); |
145 |
ok($item->can_be_transferred($library2), |
145 |
ok($item->can_be_transferred({ to => $library2 }), |
146 |
'Item can be transferred between libraries.'); |
146 |
'Item can be transferred between libraries.'); |
147 |
|
147 |
|
148 |
my $limit = Koha::Item::Transfer::Limit->new({ |
148 |
my $limit = Koha::Item::Transfer::Limit->new({ |
Lines 154-168
subtest 'can_be_transferred' => sub {
Link Here
|
154 |
fromBranch => $library1, |
154 |
fromBranch => $library1, |
155 |
toBranch => $library2, |
155 |
toBranch => $library2, |
156 |
})->count, 1, 'Given we have added a transfer limit,'); |
156 |
})->count, 1, 'Given we have added a transfer limit,'); |
157 |
is($item->can_be_transferred($library2), 0, |
157 |
is($item->can_be_transferred({ to => $library2 }), 0, |
158 |
'Item can no longer be transferred between libraries.'); |
158 |
'Item can no longer be transferred between libraries.'); |
159 |
is($item->can_be_transferred($library2, $library1), 0, |
159 |
is($item->can_be_transferred({ to => $library2, $library1 }), 0, |
160 |
'We get the same result also if we pass the from-library parameter.'); |
160 |
'We get the same result also if we pass the from-library parameter.'); |
161 |
eval { $item->can_be_transferred(); }; |
161 |
eval { $item->can_be_transferred({ to => undef }); }; |
162 |
is(ref($@), 'Koha::Exceptions::Library::NotFound', 'Exception thrown when no library given.'); |
162 |
is(ref($@), 'Koha::Exceptions::Library::NotFound', 'Exception thrown when no library given.'); |
163 |
eval { $item->can_be_transferred('heaven'); }; |
163 |
eval { $item->can_be_transferred({ to => 'heaven' }); }; |
164 |
is(ref($@), 'Koha::Exceptions::Library::NotFound', 'Exception thrown when invalid library is given.'); |
164 |
is(ref($@), 'Koha::Exceptions::Library::NotFound', 'Exception thrown when invalid library is given.'); |
165 |
eval { $item->can_be_transferred($library2, 'hell'); }; |
165 |
eval { $item->can_be_transferred({ to => $library2, from => 'hell' }); }; |
166 |
is(ref($@), 'Koha::Exceptions::Library::NotFound', 'Exception thrown when invalid library is given.'); |
166 |
is(ref($@), 'Koha::Exceptions::Library::NotFound', 'Exception thrown when invalid library is given.'); |
167 |
}; |
167 |
}; |
168 |
|
168 |
|
169 |
- |
|
|