|
Lines 42-50
my $builder = t::lib::TestBuilder->new;
Link Here
|
| 42 |
|
42 |
|
| 43 |
t::lib::Mocks::mock_config( 'enable_plugins', 1 ); |
43 |
t::lib::Mocks::mock_config( 'enable_plugins', 1 ); |
| 44 |
|
44 |
|
| 45 |
subtest 'post_renewal_action() hook tests' => sub { |
45 |
subtest '_after_circ_action() hook tests' => sub { |
| 46 |
|
46 |
|
| 47 |
plan tests => 1; |
47 |
plan tests => 2; |
| 48 |
|
48 |
|
| 49 |
$schema->storage->txn_begin; |
49 |
$schema->storage->txn_begin; |
| 50 |
|
50 |
|
|
Lines 53-59
subtest 'post_renewal_action() hook tests' => sub {
Link Here
|
| 53 |
|
53 |
|
| 54 |
my $plugin = Koha::Plugin::Test->new->enable; |
54 |
my $plugin = Koha::Plugin::Test->new->enable; |
| 55 |
|
55 |
|
| 56 |
my $patron = $builder->build_object({ class => 'Koha::Patrons' }); |
56 |
my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); |
| 57 |
|
57 |
|
| 58 |
t::lib::Mocks::mock_userenv( |
58 |
t::lib::Mocks::mock_userenv( |
| 59 |
{ |
59 |
{ |
|
Lines 64-79
subtest 'post_renewal_action() hook tests' => sub {
Link Here
|
| 64 |
|
64 |
|
| 65 |
# Avoid testing useless warnings |
65 |
# Avoid testing useless warnings |
| 66 |
my $test_plugin = Test::MockModule->new('Koha::Plugin::Test'); |
66 |
my $test_plugin = Test::MockModule->new('Koha::Plugin::Test'); |
| 67 |
$test_plugin->mock( 'after_item_action', undef ); |
67 |
$test_plugin->mock( 'after_item_action', undef ); |
| 68 |
$test_plugin->mock( 'after_biblio_action', undef ); |
68 |
$test_plugin->mock( 'after_biblio_action', undef ); |
| 69 |
|
69 |
|
| 70 |
my $biblio = $builder->build_sample_biblio(); |
70 |
my $biblio = $builder->build_sample_biblio(); |
| 71 |
my $item = $builder->build_sample_item({ biblionumber => $biblio->biblionumber }); |
71 |
my $item = |
| 72 |
AddIssue( $patron->unblessed, $item->barcode ); |
72 |
$builder->build_sample_item( { biblionumber => $biblio->biblionumber } ); |
| 73 |
|
73 |
|
| 74 |
warning_like { AddRenewal( $patron->borrowernumber, $item->id, $patron->branchcode ); } |
74 |
subtest 'AddIssue' => sub { |
| 75 |
qr/after_circ_action called with action: renewal, ref: DateTime/, |
75 |
plan tests => 1; |
| 76 |
'AddRenewal calls the post_renewal_action hook'; |
76 |
|
|
|
77 |
warning_like { AddIssue( $patron->unblessed, $item->barcode ); } |
| 78 |
qw/after_circ_action called with action: renewal, ref: DateTime/, |
| 79 |
'AddIssue calls the after_circ_action hook'; |
| 80 |
|
| 81 |
}; |
| 82 |
|
| 83 |
subtest 'AddRenewal' => sub { |
| 84 |
plan tests => 1; |
| 85 |
|
| 86 |
warning_like { |
| 87 |
AddRenewal( $patron->borrowernumber, $item->id, |
| 88 |
$patron->branchcode ); |
| 89 |
} |
| 90 |
qr/after_circ_action called with action: renewal, ref: DateTime/, |
| 91 |
'AddRenewal calls the after_circ_action hook'; |
| 92 |
}; |
| 77 |
|
93 |
|
| 78 |
$schema->storage->txn_rollback; |
94 |
$schema->storage->txn_rollback; |
| 79 |
Koha::Plugins::Methods->delete; |
95 |
Koha::Plugins::Methods->delete; |
| 80 |
- |
|
|