Lines 68-89
subtest 'after_circ_action() hook tests' => sub {
Link Here
|
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 = |
71 |
my $item_1 = $builder->build_sample_item( { biblionumber => $biblio->biblionumber } ); |
72 |
$builder->build_sample_item( { biblionumber => $biblio->biblionumber } ); |
72 |
my $item_2 = $builder->build_sample_item( { biblionumber => $biblio->biblionumber } ); |
73 |
|
73 |
|
74 |
subtest 'AddIssue' => sub { |
74 |
subtest 'AddIssue' => sub { |
75 |
plan tests => 1; |
75 |
plan tests => 2; |
76 |
|
76 |
|
77 |
warning_like { AddIssue( $patron->unblessed, $item->barcode ); } |
77 |
warning_like { AddIssue( $patron->unblessed, $item_1->barcode ); } |
78 |
qr/after_circ_action called with action: checkout, ref: DateTime/, |
78 |
qr/after_circ_action called with action: checkout, ref: Koha::Checkout type: issue/, |
79 |
'AddIssue calls the after_circ_action hook'; |
79 |
'AddIssue calls the after_circ_action hook'; |
80 |
|
80 |
|
|
|
81 |
warning_like { AddIssue( $patron->unblessed, $item_2->barcode, undef, undef, undef, undef, { onsite_checkout => 1 } ); } |
82 |
qr/after_circ_action called with action: checkout, ref: Koha::Checkout type: onsite_checkout/, |
83 |
'AddIssue calls the after_circ_action hook (onsite_checkout case)'; |
81 |
}; |
84 |
}; |
82 |
|
85 |
|
83 |
subtest 'AddRenewal' => sub { |
86 |
subtest 'AddRenewal' => sub { |
84 |
plan tests => 1; |
87 |
plan tests => 1; |
85 |
|
88 |
|
86 |
warning_like { AddRenewal( $patron->borrowernumber, $item->id, $patron->branchcode ); } |
89 |
warning_like { AddRenewal( $patron->borrowernumber, $item_1->id, $patron->branchcode ); } |
87 |
qr/after_circ_action called with action: renewal, ref: Koha::Checkout/, |
90 |
qr/after_circ_action called with action: renewal, ref: Koha::Checkout/, |
88 |
'AddRenewal calls the after_circ_action hook'; |
91 |
'AddRenewal calls the after_circ_action hook'; |
89 |
}; |
92 |
}; |
Lines 92-100
subtest 'after_circ_action() hook tests' => sub {
Link Here
|
92 |
plan tests => 1; |
95 |
plan tests => 1; |
93 |
|
96 |
|
94 |
warning_like { |
97 |
warning_like { |
95 |
AddReturn( $item->barcode, $patron->branchcode ); |
98 |
AddReturn( $item_1->barcode, $patron->branchcode ); |
96 |
} |
99 |
} |
97 |
qr/after_circ_action called with action: checkin, ref: DateTime/, |
100 |
qr/after_circ_action called with action: checkin, ref: Koha::Old::Checkout/, |
98 |
'AddReturn calls the after_circ_action hook'; |
101 |
'AddReturn calls the after_circ_action hook'; |
99 |
}; |
102 |
}; |
100 |
|
103 |
|