Lines 17-29
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 5; |
20 |
use Test::More tests => 6; |
21 |
use Test::MockModule; |
21 |
use Test::MockModule; |
|
|
22 |
use Test::Exception; |
22 |
|
23 |
|
23 |
use t::lib::TestBuilder; |
24 |
use t::lib::TestBuilder; |
24 |
use t::lib::Mocks; |
25 |
use t::lib::Mocks; |
25 |
|
26 |
|
26 |
use Koha::ArticleRequests; |
27 |
use Koha::ArticleRequests; |
|
|
28 |
use Koha::Exceptions::ArticleRequest; |
27 |
|
29 |
|
28 |
my $schema = Koha::Database->new->schema; |
30 |
my $schema = Koha::Database->new->schema; |
29 |
my $builder = t::lib::TestBuilder->new; |
31 |
my $builder = t::lib::TestBuilder->new; |
Lines 209-211
subtest 'cancel() tests' => sub {
Link Here
|
209 |
|
211 |
|
210 |
$schema->storage->txn_rollback; |
212 |
$schema->storage->txn_rollback; |
211 |
}; |
213 |
}; |
212 |
- |
214 |
|
|
|
215 |
subtest 'store' => sub { |
216 |
plan tests => 2; |
217 |
$schema->storage->txn_begin; |
218 |
|
219 |
t::lib::Mocks::mock_preference( 'ArticleRequestsSupportedFormats', 'SCAN' ); |
220 |
my $ar = $builder->build_object( { class => 'Koha::ArticleRequests', value => { format => 'PHOTOCOPY' } } ); |
221 |
throws_ok { $ar->format('test')->store } 'Koha::Exceptions::ArticleRequest::WrongFormat', |
222 |
'Format not supported'; |
223 |
t::lib::Mocks::mock_preference( 'ArticleRequestsSupportedFormats', 'SCAN|PHOTOCOPY|ELSE' ); |
224 |
lives_ok { $ar->format('PHOTOCOPY')->store } 'Now we do support it'; |
225 |
|
226 |
$schema->storage->txn_rollback; |
227 |
}; |