|
Lines 18-24
Link Here
|
| 18 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
18 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
| 19 |
|
19 |
|
| 20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
| 21 |
use Test::More tests => 85; |
21 |
use Test::More tests => 86; |
| 22 |
use Test::MockModule; |
22 |
use Test::MockModule; |
| 23 |
use Test::Warn; |
23 |
use Test::Warn; |
| 24 |
use Test::Exception; |
24 |
use Test::Exception; |
|
Lines 906-911
EOF
Link Here
|
| 906 |
is( $items_content, $expected_items_content, 'get_item_content should return correct items info without time (if dateonly => 1)' ); |
906 |
is( $items_content, $expected_items_content, 'get_item_content should return correct items info without time (if dateonly => 1)' ); |
| 907 |
}; |
907 |
}; |
| 908 |
|
908 |
|
|
|
909 |
subtest 'Test where parameter for SendQueuedMessages' => sub { |
| 910 |
plan tests => 1; |
| 911 |
|
| 912 |
my $dbh = C4::Context->dbh; |
| 913 |
|
| 914 |
my $borrowernumber = Koha::Patron->new({ |
| 915 |
firstname => 'Jane', |
| 916 |
surname => 'Smith', |
| 917 |
categorycode => $patron_category, |
| 918 |
branchcode => $library->{branchcode}, |
| 919 |
dateofbirth => $date, |
| 920 |
smsalertnumber => undef, |
| 921 |
})->store->borrowernumber; |
| 922 |
|
| 923 |
$dbh->do(q|DELETE FROM message_queue|); |
| 924 |
$my_message = { |
| 925 |
'letter' => { |
| 926 |
'content' => 'a message', |
| 927 |
'metadata' => 'metadata', |
| 928 |
'code' => 'TEST_MESSAGE', |
| 929 |
'content_type' => 'text/plain', |
| 930 |
'title' => 'message title' |
| 931 |
}, |
| 932 |
'borrowernumber' => $borrowernumber, |
| 933 |
'to_address' => undef, |
| 934 |
'message_transport_type' => 'sms', |
| 935 |
'from_address' => 'from@example.com' |
| 936 |
}; |
| 937 |
my $my_message2 = { |
| 938 |
'letter' => { |
| 939 |
'content' => 'another message', |
| 940 |
'metadata' => 'metadata', |
| 941 |
'code' => 'TEST_MESSAGE', |
| 942 |
'content_type' => 'text/plain', |
| 943 |
'title' => 'message title' |
| 944 |
}, |
| 945 |
'borrowernumber' => $borrowernumber, |
| 946 |
'to_address' => undef, |
| 947 |
'message_transport_type' => 'sms', |
| 948 |
'from_address' => 'from@example.com' |
| 949 |
}; |
| 950 |
my $my_message3 = { |
| 951 |
'letter' => { |
| 952 |
'content' => 'a skipped message', |
| 953 |
'metadata' => 'metadata', |
| 954 |
'code' => 'TEST_MESSAGE', |
| 955 |
'content_type' => 'text/plain', |
| 956 |
'title' => 'message title' |
| 957 |
}, |
| 958 |
'borrowernumber' => $borrowernumber, |
| 959 |
'to_address' => undef, |
| 960 |
'message_transport_type' => 'sms', |
| 961 |
'from_address' => 'from@example.com' |
| 962 |
}; |
| 963 |
C4::Letters::EnqueueLetter($my_message); |
| 964 |
C4::Letters::EnqueueLetter($my_message2); |
| 965 |
C4::Letters::EnqueueLetter($my_message3); |
| 966 |
my $messages_processed = C4::Letters::SendQueuedMessages( { where => q{content NOT LIKE '%skipped%'} } ); |
| 967 |
is( $messages_processed, 2, "Correctly skipped processing one message containing the work 'skipped' in contents" ); |
| 968 |
}; |
| 969 |
|
| 909 |
subtest 'Test limit parameter for SendQueuedMessages' => sub { |
970 |
subtest 'Test limit parameter for SendQueuedMessages' => sub { |
| 910 |
plan tests => 3; |
971 |
plan tests => 3; |
| 911 |
|
972 |
|
| 912 |
- |
|
|