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

(-)a/t/db_dependent/Circulation.t (-3 / +4 lines)
Lines 5404-5410 subtest "updateWrongTransfer tests" => sub { Link Here
5404
};
5404
};
5405
5405
5406
subtest "SendCirculationAlert" => sub {
5406
subtest "SendCirculationAlert" => sub {
5407
    plan tests => 2;
5407
    plan tests => 3;
5408
5408
5409
    # When you would unsuspectingly call this unit test (with perl, not prove), you will be bitten by LOCK.
5409
    # When you would unsuspectingly call this unit test (with perl, not prove), you will be bitten by LOCK.
5410
    # LOCK will commit changes and ruin your data
5410
    # LOCK will commit changes and ruin your data
Lines 5417-5423 subtest "SendCirculationAlert" => sub { Link Here
5417
    my $patron = $builder->build_object({ class => 'Koha::Patrons' });
5417
    my $patron = $builder->build_object({ class => 'Koha::Patrons' });
5418
    C4::Members::Messaging::SetMessagingPreference({
5418
    C4::Members::Messaging::SetMessagingPreference({
5419
        borrowernumber => $patron->id,
5419
        borrowernumber => $patron->id,
5420
        message_transport_types => ['email'],
5420
        message_transport_types => ['sms'],
5421
        message_attribute_id => 5
5421
        message_attribute_id => 5
5422
    });
5422
    });
5423
    my $item = $builder->build_sample_item();
5423
    my $item = $builder->build_sample_item();
Lines 5430-5436 subtest "SendCirculationAlert" => sub { Link Here
5430
            name => 'Test Checkin',
5430
            name => 'Test Checkin',
5431
            is_html => 0,
5431
            is_html => 0,
5432
            content => "Checkins:\n----\n[% biblio.title %]-[% old_checkout.issue_id %]\n----Thank you.",
5432
            content => "Checkins:\n----\n[% biblio.title %]-[% old_checkout.issue_id %]\n----Thank you.",
5433
            message_transport_type => 'email',
5433
            message_transport_type => 'sms',
5434
            lang => 'default'
5434
            lang => 'default'
5435
        }
5435
        }
5436
    })->store;
5436
    })->store;
Lines 5447-5452 subtest "SendCirculationAlert" => sub { Link Here
5447
    });
5447
    });
5448
    my $notice = Koha::Notice::Messages->find({ borrowernumber => $patron->id, letter_code => 'CHECKIN' });
5448
    my $notice = Koha::Notice::Messages->find({ borrowernumber => $patron->id, letter_code => 'CHECKIN' });
5449
    is($notice->content,"Checkins:\n".$item->biblio->title."-".$issue_1->id."\nThank you.", 'Letter generated with expected output on first checkin' );
5449
    is($notice->content,"Checkins:\n".$item->biblio->title."-".$issue_1->id."\nThank you.", 'Letter generated with expected output on first checkin' );
5450
    is($notice->to_address, $patron->smsalertnumber, "Letter has the correct to_address set to smsalertnumber for SMS type notices");
5450
5451
5451
    # Checkout an item, mark it returned, generate a notice
5452
    # Checkout an item, mark it returned, generate a notice
5452
    my $issue_2 = AddIssue( $patron->unblessed, $item->barcode);
5453
    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