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

(-)a/Koha/BackgroundJob.pm (-2 / +2 lines)
Lines 69-76 sub connect { Link Here
69
    return
69
    return
70
        unless $notification_method eq 'STOMP';
70
        unless $notification_method eq 'STOMP';
71
71
72
    my $hostname = $ENV{KOHA_STOMP_HOSTNAME} // 'localhost';
72
    my $hostname = 'localhost';
73
    my $port     = $ENV{KOHA_STOMP_PORT}     // '61613';
73
    my $port     = '61613';
74
74
75
    my $config      = C4::Context->config('message_broker');
75
    my $config      = C4::Context->config('message_broker');
76
    my $credentials = {
76
    my $credentials = {
(-)a/t/db_dependent/Koha/BackgroundJob.t (-6 / +6 lines)
Lines 22-27 use Encode; Link Here
22
use Test::More tests => 6;
22
use Test::More tests => 6;
23
use Test::MockModule;
23
use Test::MockModule;
24
use Test::Exception;
24
use Test::Exception;
25
use Test::Warn;
25
26
26
use Koha::Database;
27
use Koha::Database;
27
use Koha::BackgroundJobs;
28
use Koha::BackgroundJobs;
Lines 303-318 subtest 'decoded_data() and set_encoded_data() tests' => sub { Link Here
303
};
304
};
304
305
305
subtest 'decoded_data() and set_encoded_data() tests' => sub {
306
subtest 'decoded_data() and set_encoded_data() tests' => sub {
306
    plan tests => 2;
307
    plan tests => 3;
307
308
308
    $ENV{KOHA_STOMP_HOSTNAME} = "not_localhost";
309
    t::lib::Mocks::mock_config( 'message_broker', { hostname => 'not_localhost', port => '99999' } );
309
    $ENV{KOHA_STOMP_PORT}     = "99999";
310
310
311
    t::lib::Mocks::mock_preference( 'JobsNotificationMethod', 'STOMP' );
311
    t::lib::Mocks::mock_preference( 'JobsNotificationMethod', 'STOMP' );
312
    my $job = Koha::BackgroundJob->connect();
312
    my $job;
313
    warning_like { $job = Koha::BackgroundJob->connect() } qr{Cannot connect to broker};
313
    is( $job, undef, "Return undef if unable to connect when using stomp" );
314
    is( $job, undef, "Return undef if unable to connect when using stomp" );
314
315
315
    t::lib::Mocks::mock_preference( 'JobsNotificationMethod', 'polling' );
316
    t::lib::Mocks::mock_preference( 'JobsNotificationMethod', 'polling' );
316
    $job = Koha::BackgroundJob->connect();
317
    $job = Koha::BackgroundJob->connect();
317
    is( $job, undef, "Return undef if using polling" );
318
    is( $job, undef, "Return undef if using polling" );
318
    }
319
};
319
- 

Return to bug 39286