Lines 23-29
use Test::More tests => 11;
Link Here
|
23 |
use Test::Exception; |
23 |
use Test::Exception; |
24 |
|
24 |
|
25 |
use Koha::Suggestions; |
25 |
use Koha::Suggestions; |
26 |
use Koha::Config::SysPrefs; |
|
|
27 |
use Koha::Notice::Messages; |
26 |
use Koha::Notice::Messages; |
28 |
use Koha::Database; |
27 |
use Koha::Database; |
29 |
use Koha::DateUtils qw( dt_from_string output_pref ); |
28 |
use Koha::DateUtils qw( dt_from_string output_pref ); |
Lines 68-75
subtest 'store' => sub {
Link Here
|
68 |
$suggestion = Koha::Suggestions->find( $suggestion->suggestionid ); |
67 |
$suggestion = Koha::Suggestions->find( $suggestion->suggestionid ); |
69 |
is( $suggestion->suggesteddate, $two_days_ago_sql, 'If suggestion id modified, suggesteddate should not be modified' ); |
68 |
is( $suggestion->suggesteddate, $two_days_ago_sql, 'If suggestion id modified, suggesteddate should not be modified' ); |
70 |
|
69 |
|
71 |
my $syspref = Koha::Config::SysPrefs->find('EmailPurchaseSuggestions'); |
70 |
t::lib::Mocks::mock_preference( 'EmailPurchaseSuggestions', 0 ); |
72 |
$syspref->value(0)->store; |
|
|
73 |
Koha::Notice::Messages->search->delete; |
71 |
Koha::Notice::Messages->search->delete; |
74 |
$suggestion->STATUS('ASKED')->store; |
72 |
$suggestion->STATUS('ASKED')->store; |
75 |
my $last_message = Koha::Notice::Messages->search( {}, { order_by => { -desc => 'message_id' } } )->single; |
73 |
my $last_message = Koha::Notice::Messages->search( {}, { order_by => { -desc => 'message_id' } } )->single; |
Lines 81-88
subtest 'store' => sub {
Link Here
|
81 |
'If EmailPurchaseSuggestions is not enabled, a message should not be sent' |
79 |
'If EmailPurchaseSuggestions is not enabled, a message should not be sent' |
82 |
); |
80 |
); |
83 |
|
81 |
|
84 |
$syspref = Koha::Config::SysPrefs->find('EmailPurchaseSuggestions'); |
82 |
t::lib::Mocks::mock_preference( 'EmailPurchaseSuggestions', 'EmailAddressForSuggestions' ); |
85 |
$syspref->value('EmailAddressForSuggestions')->store; |
|
|
86 |
Koha::Notice::Messages->search->delete; |
83 |
Koha::Notice::Messages->search->delete; |
87 |
$suggestion->STATUS('ASKED')->store; |
84 |
$suggestion->STATUS('ASKED')->store; |
88 |
$last_message = Koha::Notice::Messages->search( {}, { order_by => { -desc => 'message_id' } } )->single; |
85 |
$last_message = Koha::Notice::Messages->search( {}, { order_by => { -desc => 'message_id' } } )->single; |
89 |
- |
|
|