Lines 42-48
t::lib::Mocks::mock_config( 'enable_plugins', 1 );
Link Here
|
42 |
|
42 |
|
43 |
subtest '() hook tests' => sub { |
43 |
subtest '() hook tests' => sub { |
44 |
|
44 |
|
45 |
plan tests => 2; |
45 |
plan tests => 4; |
46 |
|
46 |
|
47 |
$schema->storage->txn_begin; |
47 |
$schema->storage->txn_begin; |
48 |
|
48 |
|
Lines 51-62
subtest '() hook tests' => sub {
Link Here
|
51 |
|
51 |
|
52 |
my $plugin = Koha::Plugin::Test->new->enable; |
52 |
my $plugin = Koha::Plugin::Test->new->enable; |
53 |
|
53 |
|
54 |
my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); |
54 |
my $patron = $builder->build_object( |
55 |
my $cardnumber = $patron->cardnumber; |
55 |
{ class => 'Koha::Patrons', value => { cardnumber => undef } } ); |
56 |
|
56 |
|
|
|
57 |
t::lib::Mocks::mock_preference( 'autoMemberNum', 1 ); |
58 |
warnings_like { $patron->store(); } |
59 |
[ |
60 |
qr/patron_barcode_transform called with parameter: /, |
61 |
qr/patron_barcode_transform called with parameter: / |
62 |
], |
63 |
'Koha::Patron::store calls the patron_barcode_transform hook twice when autoMemberNum is enabled and cardnumber is undefined'; |
64 |
|
65 |
$patron->cardnumber('TEST'); |
66 |
warning_like { $patron->store(); } |
67 |
qr/patron_barcode_transform called with parameter: TEST/, |
68 |
'Koha::Patron::store calls the patron_barcode_transform hook once when autoMemberNum is enabled and cardnumber is set'; |
69 |
|
70 |
t::lib::Mocks::mock_preference( 'autoMemberNum', 0 ); |
71 |
$patron->cardnumber(undef); |
57 |
warning_like { $patron->store(); } |
72 |
warning_like { $patron->store(); } |
58 |
qr/patron_barcode_transform called with parameter: $cardnumber/, |
73 |
qr/patron_barcode_transform called with parameter: /, |
59 |
'Koha::Patron::store calls the patron_barcode_transform hook'; |
74 |
'Koha::Patron::store calls the patron_barcode_transform hook once when autoMemberNum is disabled and cardnumber is undefined'; |
60 |
|
75 |
|
61 |
t::lib::Mocks::mock_userenv( |
76 |
t::lib::Mocks::mock_userenv( |
62 |
{ |
77 |
{ |