|
Lines 15-21
Link Here
|
| 15 |
# GNU General Public License for more details. |
15 |
# GNU General Public License for more details. |
| 16 |
# |
16 |
# |
| 17 |
# You should have received a copy of the GNU General Public License |
17 |
# You should have received a copy of the GNU General Public License |
| 18 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
18 |
# along with Koha; if not, see <https://www.gnu.org/licenses>. |
| 19 |
|
19 |
|
| 20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
| 21 |
|
21 |
|
|
Lines 109-115
my $float_limit3 = Koha::Library::FloatLimit->new(
Link Here
|
| 109 |
)->store(); |
109 |
)->store(); |
| 110 |
|
110 |
|
| 111 |
is( |
111 |
is( |
| 112 |
Koha::Library::FloatLimits->lowest_ratio_library( $item, $library1->{branchcode} )->branchcode, |
112 |
Koha::Library::FloatLimits->lowest_ratio_library( $item, $library1->{branchcode}, $item->holdingbranch ) |
|
|
113 |
->branchcode, |
| 113 |
$library3->{branchcode}, |
114 |
$library3->{branchcode}, |
| 114 |
"Correct library selected for float limit transfer" |
115 |
"Correct library selected for float limit transfer" |
| 115 |
); |
116 |
); |
|
Lines 137-144
subtest 'FloatLimits: General tests' => sub {
Link Here
|
| 137 |
itype => $builder->build_object( { class => 'Koha::ItemTypes' } )->itemtype, |
138 |
itype => $builder->build_object( { class => 'Koha::ItemTypes' } )->itemtype, |
| 138 |
} |
139 |
} |
| 139 |
); |
140 |
); |
| 140 |
|
141 |
my $no_limits_result = Koha::Library::FloatLimits->lowest_ratio_library( |
| 141 |
my $no_limits_result = Koha::Library::FloatLimits->lowest_ratio_library( $no_limits_item, $library1->{branchcode} ); |
142 |
$no_limits_item, $library1->{branchcode}, |
|
|
143 |
$no_limits_item->holdingbranch |
| 144 |
); |
| 142 |
is( $no_limits_result, undef, "Returns undef when no float limits defined" ); |
145 |
is( $no_limits_result, undef, "Returns undef when no float limits defined" ); |
| 143 |
|
146 |
|
| 144 |
# Test with only zero float limits |
147 |
# Test with only zero float limits |
|
Lines 163-170
subtest 'FloatLimits: General tests' => sub {
Link Here
|
| 163 |
itype => $unknown_itemtype->itemtype, |
166 |
itype => $unknown_itemtype->itemtype, |
| 164 |
} |
167 |
} |
| 165 |
); |
168 |
); |
| 166 |
|
169 |
my $unknown_result = Koha::Library::FloatLimits->lowest_ratio_library( |
| 167 |
my $unknown_result = Koha::Library::FloatLimits->lowest_ratio_library( $unknown_item, $library1->{branchcode} ); |
170 |
$unknown_item, $library1->{branchcode}, |
|
|
171 |
$unknown_item->holdingbranch |
| 172 |
); |
| 168 |
is( $unknown_result, undef, "Returns undef for item type not in float limits" ); |
173 |
is( $unknown_result, undef, "Returns undef for item type not in float limits" ); |
| 169 |
|
174 |
|
| 170 |
$schema->storage->txn_rollback; |
175 |
$schema->storage->txn_rollback; |
| 171 |
- |
|
|