|
Lines 19-25
Link Here
|
| 19 |
|
19 |
|
| 20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
| 21 |
|
21 |
|
| 22 |
use Test::More tests => 2; |
22 |
use Test::More tests => 3; |
|
|
23 |
use Try::Tiny; |
| 23 |
|
24 |
|
| 24 |
use C4::Circulation; |
25 |
use C4::Circulation; |
| 25 |
|
26 |
|
|
Lines 35-40
use t::lib::Mocks;
Link Here
|
| 35 |
my $schema = Koha::Database->new->schema; |
36 |
my $schema = Koha::Database->new->schema; |
| 36 |
my $builder = t::lib::TestBuilder->new; |
37 |
my $builder = t::lib::TestBuilder->new; |
| 37 |
|
38 |
|
|
|
39 |
subtest 'Config does not exist' => sub { |
| 40 |
|
| 41 |
plan tests => 2; |
| 42 |
|
| 43 |
$schema->storage->txn_begin; |
| 44 |
|
| 45 |
t::lib::Mocks::mock_config( 'key', '' ); |
| 46 |
t::lib::Mocks::mock_preference( 'Pseudonymization', 1 ); |
| 47 |
t::lib::Mocks::mock_preference( 'PseudonymizationPatronFields', 'branchcode,categorycode,sort1' ); |
| 48 |
|
| 49 |
my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); |
| 50 |
my $patron_info = $patron->unblessed; |
| 51 |
delete $patron_info->{borrowernumber}; |
| 52 |
$patron->delete; |
| 53 |
|
| 54 |
try{ |
| 55 |
$patron = Koha::Patron->new($patron_info)->store; |
| 56 |
} catch { |
| 57 |
ok($_->isa('Koha::Exceptions::Config::MissingEntry'), "Koha::Patron->store should raise a Koha::Exceptions::Config::MissingEntry if 'key' is not defined in the config"); |
| 58 |
is( $_->message, "Missing 'key' entry in config file"); |
| 59 |
}; |
| 60 |
|
| 61 |
$schema->storage->txn_rollback; |
| 62 |
}; |
| 63 |
|
| 38 |
subtest 'Koha::Anonymized::Patrons tests' => sub { |
64 |
subtest 'Koha::Anonymized::Patrons tests' => sub { |
| 39 |
|
65 |
|
| 40 |
plan tests => 9; |
66 |
plan tests => 9; |
| 41 |
- |
|
|