Lines 106-112
subtest 'can_be_transferred' => sub {
Link Here
|
106 |
fromBranch => $library1, |
106 |
fromBranch => $library1, |
107 |
toBranch => $library2, |
107 |
toBranch => $library2, |
108 |
})->count, 0, 'There are no transfer limits between libraries.'); |
108 |
})->count, 0, 'There are no transfer limits between libraries.'); |
109 |
ok($item->can_be_transferred($library2), |
109 |
ok($item->can_be_transferred({ to => $library2 }), |
110 |
'Item can be transferred between libraries.'); |
110 |
'Item can be transferred between libraries.'); |
111 |
|
111 |
|
112 |
my $limit = Koha::Item::Transfer::Limit->new({ |
112 |
my $limit = Koha::Item::Transfer::Limit->new({ |
Lines 118-132
subtest 'can_be_transferred' => sub {
Link Here
|
118 |
fromBranch => $library1, |
118 |
fromBranch => $library1, |
119 |
toBranch => $library2, |
119 |
toBranch => $library2, |
120 |
})->count, 1, 'Given we have added a transfer limit,'); |
120 |
})->count, 1, 'Given we have added a transfer limit,'); |
121 |
is($item->can_be_transferred($library2), 0, |
121 |
is($item->can_be_transferred({ to => $library2 }), 0, |
122 |
'Item can no longer be transferred between libraries.'); |
122 |
'Item can no longer be transferred between libraries.'); |
123 |
is($item->can_be_transferred($library2, $library1), 0, |
123 |
is($item->can_be_transferred({ to => $library2, $library1 }), 0, |
124 |
'We get the same result also if we pass the from-library parameter.'); |
124 |
'We get the same result also if we pass the from-library parameter.'); |
125 |
eval { $item->can_be_transferred(); }; |
125 |
eval { $item->can_be_transferred({ to => undef }); }; |
126 |
is(ref($@), 'Koha::Exceptions::Library::NotFound', 'Exception thrown when no library given.'); |
126 |
is(ref($@), 'Koha::Exceptions::Library::NotFound', 'Exception thrown when no library given.'); |
127 |
eval { $item->can_be_transferred('heaven'); }; |
127 |
eval { $item->can_be_transferred({ to => 'heaven' }); }; |
128 |
is(ref($@), 'Koha::Exceptions::Library::NotFound', 'Exception thrown when invalid library is given.'); |
128 |
is(ref($@), 'Koha::Exceptions::Library::NotFound', 'Exception thrown when invalid library is given.'); |
129 |
eval { $item->can_be_transferred($library2, 'hell'); }; |
129 |
eval { $item->can_be_transferred({ to => $library2, from => 'hell' }); }; |
130 |
is(ref($@), 'Koha::Exceptions::Library::NotFound', 'Exception thrown when invalid library is given.'); |
130 |
is(ref($@), 'Koha::Exceptions::Library::NotFound', 'Exception thrown when invalid library is given.'); |
131 |
}; |
131 |
}; |
132 |
|
132 |
|
133 |
- |
|
|