|
Line 0
Link Here
|
| 0 |
- |
1 |
#!/usr/bin/perl |
|
|
2 |
|
| 3 |
# This file is part of Koha. |
| 4 |
# |
| 5 |
# Koha is free software; you can redistribute it and/or modify it under the |
| 6 |
# terms of the GNU General Public License as published by the Free Software |
| 7 |
# Foundation; either version 3 of the License, or (at your option) any later |
| 8 |
# version. |
| 9 |
# |
| 10 |
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY |
| 11 |
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
| 12 |
# A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
| 13 |
# |
| 14 |
# You should have received a copy of the GNU General Public License along |
| 15 |
# with Koha; if not, see <http://www.gnu.org/licenses>. |
| 16 |
|
| 17 |
use Modern::Perl; |
| 18 |
use Test::More tests => 1; |
| 19 |
|
| 20 |
use t::lib::TestBuilder; |
| 21 |
use t::lib::Mocks; |
| 22 |
|
| 23 |
use Koha::Database; |
| 24 |
use Koha::Template::Plugin::ItemTypes; |
| 25 |
|
| 26 |
my $schema = Koha::Database->schema; |
| 27 |
our $builder = t::lib::TestBuilder->new; |
| 28 |
$schema->storage->txn_begin; |
| 29 |
|
| 30 |
subtest 'Notforloan' => sub { |
| 31 |
plan tests => 3; |
| 32 |
|
| 33 |
my $itemtype1 = $builder->build_object({ class => 'Koha::ItemTypes' }); |
| 34 |
my $itemtype2 = $builder->build_object({ class => 'Koha::ItemTypes' }); |
| 35 |
$itemtype2->notforloan(1)->store; |
| 36 |
|
| 37 |
my $template_plugin = Koha::Template::Plugin::ItemTypes->new; |
| 38 |
|
| 39 |
is( $template_plugin->Notforloan('SHOULD_NOT_BE_THERE'), undef, 'Undefined when not found' ); |
| 40 |
is( $template_plugin->Notforloan($itemtype1->itemtype), 0, 'Itemtype 1 not set' ); |
| 41 |
is( $template_plugin->Notforloan($itemtype2->itemtype), 1, 'Itemtype 2 set' ); |
| 42 |
}; |
| 43 |
|
| 44 |
$schema->storage->txn_rollback; |