View | Details | Raw Unified | Return to bug 30838
Collapse All | Expand All

(-)a/t/db_dependent/Circulation.t (-3 / +4 lines)
Lines 5385-5391 subtest "updateWrongTransfer tests" => sub { Link Here
5385
};
5385
};
5386
5386
5387
subtest "SendCirculationAlert" => sub {
5387
subtest "SendCirculationAlert" => sub {
5388
    plan tests => 2;
5388
    plan tests => 3;
5389
5389
5390
    # When you would unsuspectingly call this unit test (with perl, not prove), you will be bitten by LOCK.
5390
    # When you would unsuspectingly call this unit test (with perl, not prove), you will be bitten by LOCK.
5391
    # LOCK will commit changes and ruin your data
5391
    # LOCK will commit changes and ruin your data
Lines 5398-5404 subtest "SendCirculationAlert" => sub { Link Here
5398
    my $patron = $builder->build_object({ class => 'Koha::Patrons' });
5398
    my $patron = $builder->build_object({ class => 'Koha::Patrons' });
5399
    C4::Members::Messaging::SetMessagingPreference({
5399
    C4::Members::Messaging::SetMessagingPreference({
5400
        borrowernumber => $patron->id,
5400
        borrowernumber => $patron->id,
5401
        message_transport_types => ['email'],
5401
        message_transport_types => ['sms'],
5402
        message_attribute_id => 5
5402
        message_attribute_id => 5
5403
    });
5403
    });
5404
    my $item = $builder->build_sample_item();
5404
    my $item = $builder->build_sample_item();
Lines 5411-5417 subtest "SendCirculationAlert" => sub { Link Here
5411
            name => 'Test Checkin',
5411
            name => 'Test Checkin',
5412
            is_html => 0,
5412
            is_html => 0,
5413
            content => "Checkins:\n----\n[% biblio.title %]-[% old_checkout.issue_id %]\n----Thank you.",
5413
            content => "Checkins:\n----\n[% biblio.title %]-[% old_checkout.issue_id %]\n----Thank you.",
5414
            message_transport_type => 'email',
5414
            message_transport_type => 'sms',
5415
            lang => 'default'
5415
            lang => 'default'
5416
        }
5416
        }
5417
    })->store;
5417
    })->store;
Lines 5428-5433 subtest "SendCirculationAlert" => sub { Link Here
5428
    });
5428
    });
5429
    my $notice = Koha::Notice::Messages->find({ borrowernumber => $patron->id, letter_code => 'CHECKIN' });
5429
    my $notice = Koha::Notice::Messages->find({ borrowernumber => $patron->id, letter_code => 'CHECKIN' });
5430
    is($notice->content,"Checkins:\n".$item->biblio->title."-".$issue_1->id."\nThank you.", 'Letter generated with expected output on first checkin' );
5430
    is($notice->content,"Checkins:\n".$item->biblio->title."-".$issue_1->id."\nThank you.", 'Letter generated with expected output on first checkin' );
5431
    is($notice->to_address, $patron->smsalertnumber, "Letter has the correct to_address set to smsalertnumber for SMS type notices");
5431
5432
5432
    # Checkout an item, mark it returned, generate a notice
5433
    # Checkout an item, mark it returned, generate a notice
5433
    my $issue_2 = AddIssue( $patron->unblessed, $item->barcode);
5434
    my $issue_2 = AddIssue( $patron->unblessed, $item->barcode);
(-)a/t/db_dependent/Letters.t (-3 / +15 lines)
Lines 779-787 subtest 'TranslateNotices' => sub { Link Here
779
779
780
};
780
};
781
781
782
subtest 'SendQueuedMessages' => sub {
782
subtest 'Test SMS handling in SendQueuedMessages' => sub {
783
783
784
    plan tests => 12;
784
    plan tests => 13;
785
785
786
    t::lib::Mocks::mock_preference( 'SMSSendDriver', 'Email' );
786
    t::lib::Mocks::mock_preference( 'SMSSendDriver', 'Email' );
787
    t::lib::Mocks::mock_preference('EmailSMSSendDriverFromAddress', '');
787
    t::lib::Mocks::mock_preference('EmailSMSSendDriverFromAddress', '');
Lines 855-860 subtest 'SendQueuedMessages' => sub { Link Here
855
    })->next()->to_address();
855
    })->next()->to_address();
856
    is( $sms_message_address, '5555555555@kidclamp.rocks', 'SendQueuedMessages populates the to address correctly for SMS by email when to_address is set incorrectly' );
856
    is( $sms_message_address, '5555555555@kidclamp.rocks', 'SendQueuedMessages populates the to address correctly for SMS by email when to_address is set incorrectly' );
857
857
858
    # Test using SMS::Send::Test driver that's bundled with SMS::Send
859
    t::lib::Mocks::mock_preference('SMSSendDriver', "AU::Test");
860
861
    $schema->resultset('MessageQueue')->search({borrowernumber => $borrowernumber, status => 'sent'})->delete(); #clear borrower queue
862
    C4::Letters::EnqueueLetter($my_message);
863
    C4::Letters::SendQueuedMessages();
864
865
    $sms_message_address = $schema->resultset('MessageQueue')->search({
866
        borrowernumber => $borrowernumber,
867
        status => 'sent'
868
    })->next()->to_address();
869
    is( $sms_message_address, '5555555555', 'SendQueuedMessages populates the to address correctly for SMS by SMS::Send driver to smsalertnumber when to_address is set incorrectly' );
870
858
};
871
};
859
872
860
subtest 'get_item_content' => sub {
873
subtest 'get_item_content' => sub {
861
- 

Return to bug 30838