Lines 51-57
use_ok('Koha::ILL::Requests');
Link Here
|
51 |
|
51 |
|
52 |
subtest 'Basic object tests' => sub { |
52 |
subtest 'Basic object tests' => sub { |
53 |
|
53 |
|
54 |
plan tests => 24; |
54 |
plan tests => 27; |
55 |
|
55 |
|
56 |
$schema->storage->txn_begin; |
56 |
$schema->storage->txn_begin; |
57 |
|
57 |
|
Lines 160-166
subtest 'Basic object tests' => sub {
Link Here
|
160 |
$illrq_obj->status, 'COMP', |
160 |
$illrq_obj->status, 'COMP', |
161 |
"ILL is not currently marked complete." |
161 |
"ILL is not currently marked complete." |
162 |
); |
162 |
); |
163 |
$illrq_obj->mark_completed; |
163 |
|
|
|
164 |
my $backend = Test::MockObject->new; |
165 |
$backend->set_isa('Koha::Illbackends::Mock'); |
166 |
$backend->set_always( 'name', 'Mock' ); |
167 |
$backend->mock( 'capabilities', sub { return 'Mock'; } ); |
168 |
|
169 |
my $config = Test::MockObject->new; |
170 |
$config->set_always( 'backend_dir', "/tmp" ); |
171 |
|
172 |
$illrq_obj->_config($config); |
173 |
$illrq_obj->_backend($backend); |
174 |
|
175 |
my $cat = Koha::AuthorisedValueCategories->search( { category_name => 'ILL_STATUS_ALIAS' } ); |
176 |
|
177 |
if ( $cat->count == 0 ) { |
178 |
$cat = $builder->build_object( |
179 |
{ |
180 |
class => 'Koha::AuthorisedValueCategory', |
181 |
value => { category_name => 'ILL_STATUS_ALIAS' } |
182 |
} |
183 |
); |
184 |
} |
185 |
|
186 |
my $av = $builder->build_object( |
187 |
{ |
188 |
class => 'Koha::AuthorisedValues', |
189 |
value => { category => 'ILL_STATUS_ALIAS' } |
190 |
} |
191 |
); |
192 |
|
193 |
my $mark_comp_return = $illrq_obj->mark_completed; |
194 |
|
195 |
isnt( |
196 |
$illrq_obj->status, 'COMP', |
197 |
"ILL_STATUS_ALIAS is not empty. ILL is not immediatelly complete." |
198 |
); |
199 |
|
200 |
is( |
201 |
$mark_comp_return->{method}, 'mark_completed', |
202 |
"ILL_STATUS_ALIAS is not empty. Rendering 'mark_completed' view" |
203 |
); |
204 |
|
205 |
Koha::AuthorisedValues->search( { 'category' => 'ILL_STATUS_ALIAS' } )->delete; |
206 |
|
207 |
$mark_comp_return = $illrq_obj->mark_completed; |
208 |
|
209 |
is_deeply( |
210 |
$mark_comp_return, |
211 |
{ next => 'illview', stage => 'commit' }, |
212 |
"ILL_STATUS_ALIAS is empty. Skip 'complete' view and go straight to illview" |
213 |
); |
214 |
|
164 |
is( |
215 |
is( |
165 |
$illrq_obj->status, 'COMP', |
216 |
$illrq_obj->status, 'COMP', |
166 |
"ILL is now marked complete." |
217 |
"ILL is now marked complete." |
167 |
- |
|
|