Lines 98-104
subtest 'can_be_transferred' => sub {
Link Here
|
98 |
fromBranch => $library1, |
98 |
fromBranch => $library1, |
99 |
toBranch => $library2, |
99 |
toBranch => $library2, |
100 |
})->count, 0, 'There are no transfer limits between libraries.'); |
100 |
})->count, 0, 'There are no transfer limits between libraries.'); |
101 |
ok($item->can_be_transferred($library2), |
101 |
ok($item->can_be_transferred({ to => $library2 }), |
102 |
'Item can be transferred between libraries.'); |
102 |
'Item can be transferred between libraries.'); |
103 |
|
103 |
|
104 |
my $limit = Koha::Item::Transfer::Limit->new({ |
104 |
my $limit = Koha::Item::Transfer::Limit->new({ |
Lines 110-124
subtest 'can_be_transferred' => sub {
Link Here
|
110 |
fromBranch => $library1, |
110 |
fromBranch => $library1, |
111 |
toBranch => $library2, |
111 |
toBranch => $library2, |
112 |
})->count, 1, 'Given we have added a transfer limit,'); |
112 |
})->count, 1, 'Given we have added a transfer limit,'); |
113 |
is($item->can_be_transferred($library2), 0, |
113 |
is($item->can_be_transferred({ to => $library2 }), 0, |
114 |
'Item can no longer be transferred between libraries.'); |
114 |
'Item can no longer be transferred between libraries.'); |
115 |
is($item->can_be_transferred($library2, $library1), 0, |
115 |
is($item->can_be_transferred({ to => $library2, $library1 }), 0, |
116 |
'We get the same result also if we pass the from-library parameter.'); |
116 |
'We get the same result also if we pass the from-library parameter.'); |
117 |
eval { $item->can_be_transferred(); }; |
117 |
eval { $item->can_be_transferred({ to => undef }); }; |
118 |
is(ref($@), 'Koha::Exceptions::Library::NotFound', 'Exception thrown when no library given.'); |
118 |
is(ref($@), 'Koha::Exceptions::Library::NotFound', 'Exception thrown when no library given.'); |
119 |
eval { $item->can_be_transferred('heaven'); }; |
119 |
eval { $item->can_be_transferred({ to => 'heaven' }); }; |
120 |
is(ref($@), 'Koha::Exceptions::Library::NotFound', 'Exception thrown when invalid library is given.'); |
120 |
is(ref($@), 'Koha::Exceptions::Library::NotFound', 'Exception thrown when invalid library is given.'); |
121 |
eval { $item->can_be_transferred($library2, 'hell'); }; |
121 |
eval { $item->can_be_transferred({ to => $library2, from => 'hell' }); }; |
122 |
is(ref($@), 'Koha::Exceptions::Library::NotFound', 'Exception thrown when invalid library is given.'); |
122 |
is(ref($@), 'Koha::Exceptions::Library::NotFound', 'Exception thrown when invalid library is given.'); |
123 |
}; |
123 |
}; |
124 |
|
124 |
|
125 |
- |
|
|