View | Details | Raw Unified | Return to bug 24151
Collapse All | Expand All

(-)a/t/db_dependent/Koha/Pseudonymization.t (-3 / +38 lines)
Lines 19-27 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 1;
22
use Test::More tests => 2;
23
use Try::Tiny;
23
24
24
use C4::Circulation;
25
use C4::Circulation;
26
use C4::Stats;
25
27
26
use Koha::Database;
28
use Koha::Database;
27
use Koha::DateUtils qw( dt_from_string );
29
use Koha::DateUtils qw( dt_from_string );
Lines 34-40 use t::lib::Mocks; Link Here
34
my $schema  = Koha::Database->new->schema;
36
my $schema  = Koha::Database->new->schema;
35
my $builder = t::lib::TestBuilder->new;
37
my $builder = t::lib::TestBuilder->new;
36
38
37
subtest 'Koha::PseudonymizedTransactions tests' => sub {
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 $library = $builder->build_object( { class => 'Koha::Libraries' } );
50
    my $item    = $builder->build_sample_item;
51
    my $patron  = $builder->build_object( { class => 'Koha::Patrons' } );
52
53
    try{
54
        C4::Stats::UpdateStats(
55
            {
56
                type           => 'issue',
57
                branch         => 'BBB',
58
                itemnumber     => $item->itemnumber,
59
                borrowernumber => $patron->borrowernumber,
60
                itemtype       => $item->effective_itemtype,
61
                location       => $item->location,
62
            }
63
        );
64
65
    } catch {
66
        ok($_->isa('Koha::Exceptions::Config::MissingEntry'), "Koha::Patron->store should raise a Koha::Exceptions::Config::MissingEntry if 'key' is not defined in the config");
67
        is( $_->message, "Missing 'key' entry in config file");
68
    };
69
70
    $schema->storage->txn_rollback;
71
};
72
73
subtest 'Koha::Anonymized::Transactions tests' => sub {
38
74
39
    plan tests => 11;
75
    plan tests => 11;
40
76
41
- 

Return to bug 24151