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 => 11; |
24 |
use Test::More tests => 12; |
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 95-100
subtest 'Test hold_patron_bcode' => sub {
Link Here
|
95 |
$schema->storage->txn_rollback; |
95 |
$schema->storage->txn_rollback; |
96 |
}; |
96 |
}; |
97 |
|
97 |
|
|
|
98 |
subtest 'UseLocationAsAQInSIP syspref tests' => sub { |
99 |
plan tests => 2; |
100 |
|
101 |
my $schema = Koha::Database->new->schema; |
102 |
$schema->storage->txn_begin; |
103 |
|
104 |
my $builder = t::lib::TestBuilder->new(); |
105 |
|
106 |
my $branchcode = $builder->build({ source => 'Branch' })->{branchcode}; |
107 |
my $branchcode_permanent_location = $builder->build({ source => 'Branch' })->{branchcode}; |
108 |
|
109 |
my $mocks = create_mocks( \$branchcode, \$branchcode_permanent_location ); |
110 |
|
111 |
t::lib::Mocks::mock_preference('UseLocationAsAQInSIP', 0); |
112 |
|
113 |
my $item = $builder->build_sample_item( |
114 |
{ |
115 |
damaged => 0, |
116 |
withdrawn => 0, |
117 |
itemlost => 0, |
118 |
restricted => 0, |
119 |
homebranch => $branchcode, |
120 |
holdingbranch => $branchcode, |
121 |
permanent_location => $branchcode_permanent_location |
122 |
} |
123 |
); |
124 |
|
125 |
my $sip_item = C4::SIP::ILS::Item->new( $item->barcode ); |
126 |
is( $sip_item->permanent_location, $branchcode, "When UseLocationAsAQInSIP is not set SIP item has permanent_location set to value of homebranch" ); |
127 |
|
128 |
t::lib::Mocks::mock_preference('UseLocationAsAQInSIP', 1); |
129 |
|
130 |
$item = $builder->build_sample_item( |
131 |
{ |
132 |
damaged => 0, |
133 |
withdrawn => 0, |
134 |
itemlost => 0, |
135 |
restricted => 0, |
136 |
homebranch => $branchcode, |
137 |
holdingbranch => $branchcode, |
138 |
permanent_location => $branchcode_permanent_location |
139 |
} |
140 |
); |
141 |
|
142 |
$sip_item = C4::SIP::ILS::Item->new( $item->barcode ); |
143 |
is( $sip_item->permanent_location, $branchcode_permanent_location, "When UseLocationAsAQInSIP is set SIP item has permanent_location set to value of item permanent_location" ); |
144 |
|
145 |
$schema->storage->txn_rollback; |
146 |
}; |
147 |
|
98 |
subtest 'hold_patron_name() tests' => sub { |
148 |
subtest 'hold_patron_name() tests' => sub { |
99 |
|
149 |
|
100 |
plan tests => 2; |
150 |
plan tests => 2; |
101 |
- |
|
|