Lines 73-99
is( $retrieved_review_1_1->review, $new_review_1_1->review, 'Find a review by id
Link Here
|
73 |
$retrieved_review_1_1->delete; |
73 |
$retrieved_review_1_1->delete; |
74 |
is( Koha::Reviews->search->count, $nb_of_reviews + 2, 'Delete should have deleted the review' ); |
74 |
is( Koha::Reviews->search->count, $nb_of_reviews + 2, 'Delete should have deleted the review' ); |
75 |
|
75 |
|
76 |
# Test SendReview Alert |
76 |
# Test send_review_alert |
77 |
|
77 |
|
78 |
# empty CommentModeratorsEmail |
78 |
# empty CommentModeratorsEmail |
79 |
t::lib::Mocks::mock_preference('CommentModeratorsEmail',undef); |
79 |
t::lib::Mocks::mock_preference('CommentModeratorsEmail',undef); |
80 |
warning_like { |
80 |
warning_like { |
81 |
$new_review_1_2->SendReviewAlert({ |
81 |
$new_review_1_2->send_review_alert({ |
82 |
borrowernumber => $patron_1->{borrowernumber}, |
82 |
borrowernumber => $patron_1->{borrowernumber}, |
83 |
biblionumber => $biblio_2->{biblionumber}, |
83 |
biblionumber => $biblio_2->{biblionumber}, |
84 |
reviewid => $new_review_1_2->reviewid |
84 |
reviewid => $new_review_1_2->reviewid |
85 |
}) } qr/CommentModeratorsEmail is not set!/, 'SendReviewAlert triggered expected CommentModeratorsEmail warning.'; |
85 |
}) } qr/CommentModeratorsEmail is not set!/, 'send_review_alert triggered expected CommentModeratorsEmail warning.'; |
86 |
is( Koha::Notice::Messages->search->count, $nb_of_messages, 'SendReviewAlert lacking CommentModeratorsEmail triggered nothing.' ); |
86 |
is( Koha::Notice::Messages->search->count, $nb_of_messages, 'send_review_alert lacking CommentModeratorsEmail triggered nothing.' ); |
87 |
|
87 |
|
88 |
# set CommentModeratorsEmail |
88 |
# set CommentModeratorsEmail |
89 |
t::lib::Mocks::mock_preference('CommentModeratorsEmail','test@test.test'); |
89 |
t::lib::Mocks::mock_preference('CommentModeratorsEmail','test@test.test'); |
90 |
warning_is { |
90 |
warning_is { |
91 |
$new_review_1_2->SendReviewAlert({ |
91 |
$new_review_1_2->send_review_alert({ |
92 |
borrowernumber => $patron_1->{borrowernumber}, |
92 |
borrowernumber => $patron_1->{borrowernumber}, |
93 |
biblionumber => $biblio_2->{biblionumber}, |
93 |
biblionumber => $biblio_2->{biblionumber}, |
94 |
reviewid => $new_review_1_2->reviewid |
94 |
reviewid => $new_review_1_2->reviewid |
95 |
}) } '', 'SendReviewAlert triggered no warnings as expected.'; |
95 |
}) } '', 'send_review_alert triggered no warnings as expected.'; |
96 |
is( Koha::Notice::Messages->search->count, $nb_of_messages+1, 'SendReviewAlert triggered notice.' ); |
96 |
is( Koha::Notice::Messages->search->count, $nb_of_messages+1, 'send_review_alert triggered notice.' ); |
97 |
|
97 |
|
98 |
# letter missing |
98 |
# letter missing |
99 |
Koha::Notice::Templates->search({ |
99 |
Koha::Notice::Templates->search({ |
Lines 101-114
Koha::Notice::Templates->search({
Link Here
|
101 |
code => 'COMMENT_CREATED' |
101 |
code => 'COMMENT_CREATED' |
102 |
})->delete; |
102 |
})->delete; |
103 |
warnings_like { |
103 |
warnings_like { |
104 |
$new_review_1_2->SendReviewAlert({ |
104 |
$new_review_1_2->send_review_alert({ |
105 |
borrowernumber => $patron_1->{borrowernumber}, |
105 |
borrowernumber => $patron_1->{borrowernumber}, |
106 |
biblionumber => $biblio_2->{biblionumber}, |
106 |
biblionumber => $biblio_2->{biblionumber}, |
107 |
reviewid => $new_review_1_2->reviewid |
107 |
reviewid => $new_review_1_2->reviewid |
108 |
}) } |
108 |
}) } |
109 |
[ qr/No members COMMENT_CREATED letter transported by email/, |
109 |
[ qr/No members COMMENT_CREATED letter transported by email/, |
110 |
qr/COMMENT_CREATED member letter not found!/ ] , 'SendReviewAlert triggered expected COMMENT_CREATED warnings.'; |
110 |
qr/COMMENT_CREATED member letter not found!/ ] , 'send_review_alert triggered expected COMMENT_CREATED warnings.'; |
111 |
is( Koha::Notice::Messages->search->count, $nb_of_messages+1, 'SendReviewAlert lacking letter triggered nothing new.' ); |
111 |
is( Koha::Notice::Messages->search->count, $nb_of_messages+1, 'send_review_alert lacking letter triggered nothing new.' ); |
112 |
|
112 |
|
113 |
$schema->storage->txn_rollback; |
113 |
$schema->storage->txn_rollback; |
114 |
|
114 |
|
115 |
- |
|
|