|
Lines 21-27
Link Here
|
| 21 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
21 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
| 22 |
|
22 |
|
| 23 |
use Modern::Perl; |
23 |
use Modern::Perl; |
| 24 |
use Test::More tests => 13; |
24 |
use Test::More tests => 14; |
| 25 |
use Test::Exception; |
25 |
use Test::Exception; |
| 26 |
use Test::MockObject; |
26 |
use Test::MockObject; |
| 27 |
use Test::MockModule; |
27 |
use Test::MockModule; |
|
Lines 113-118
subtest 'Test hold_patron_bcode' => sub {
Link Here
|
| 113 |
$schema->storage->txn_rollback; |
113 |
$schema->storage->txn_rollback; |
| 114 |
}; |
114 |
}; |
| 115 |
|
115 |
|
|
|
116 |
subtest 'UseLocationAsAQInSIP syspref tests' => sub { |
| 117 |
plan tests => 2; |
| 118 |
|
| 119 |
my $schema = Koha::Database->new->schema; |
| 120 |
$schema->storage->txn_begin; |
| 121 |
|
| 122 |
my $builder = t::lib::TestBuilder->new(); |
| 123 |
|
| 124 |
my $branchcode = $builder->build({ source => 'Branch' })->{branchcode}; |
| 125 |
my $branchcode_permanent_location = $builder->build({ source => 'Branch' })->{branchcode}; |
| 126 |
|
| 127 |
my $mocks = create_mocks( \$branchcode, \$branchcode_permanent_location ); |
| 128 |
|
| 129 |
t::lib::Mocks::mock_preference('UseLocationAsAQInSIP', 0); |
| 130 |
|
| 131 |
my $item = $builder->build_sample_item( |
| 132 |
{ |
| 133 |
damaged => 0, |
| 134 |
withdrawn => 0, |
| 135 |
itemlost => 0, |
| 136 |
restricted => 0, |
| 137 |
homebranch => $branchcode, |
| 138 |
holdingbranch => $branchcode, |
| 139 |
permanent_location => $branchcode_permanent_location |
| 140 |
} |
| 141 |
); |
| 142 |
|
| 143 |
my $sip_item = C4::SIP::ILS::Item->new( $item->barcode ); |
| 144 |
is( $sip_item->permanent_location, $branchcode, "When UseLocationAsAQInSIP is not set SIP item has permanent_location set to value of homebranch" ); |
| 145 |
|
| 146 |
t::lib::Mocks::mock_preference('UseLocationAsAQInSIP', 1); |
| 147 |
|
| 148 |
$item = $builder->build_sample_item( |
| 149 |
{ |
| 150 |
damaged => 0, |
| 151 |
withdrawn => 0, |
| 152 |
itemlost => 0, |
| 153 |
restricted => 0, |
| 154 |
homebranch => $branchcode, |
| 155 |
holdingbranch => $branchcode, |
| 156 |
permanent_location => $branchcode_permanent_location |
| 157 |
} |
| 158 |
); |
| 159 |
|
| 160 |
$sip_item = C4::SIP::ILS::Item->new( $item->barcode ); |
| 161 |
is( $sip_item->permanent_location, $branchcode_permanent_location, "When UseLocationAsAQInSIP is set SIP item has permanent_location set to value of item permanent_location" ); |
| 162 |
|
| 163 |
$schema->storage->txn_rollback; |
| 164 |
}; |
| 165 |
|
| 116 |
subtest 'hold_patron_name() tests' => sub { |
166 |
subtest 'hold_patron_name() tests' => sub { |
| 117 |
|
167 |
|
| 118 |
plan tests => 3; |
168 |
plan tests => 3; |
| 119 |
- |
|
|