Lines 29-38
my $builder = t::lib::TestBuilder->new;
Link Here
|
29 |
|
29 |
|
30 |
subtest 'get_default() tests' => sub { |
30 |
subtest 'get_default() tests' => sub { |
31 |
|
31 |
|
32 |
plan tests => 3; |
32 |
plan tests => 5; |
33 |
|
33 |
|
34 |
$schema->storage->txn_begin; |
34 |
$schema->storage->txn_begin; |
35 |
|
35 |
|
|
|
36 |
t::lib::Mocks::mock_config( 'smtp_server', undef ); |
37 |
|
36 |
my $server = Koha::SMTP::Servers->get_default; |
38 |
my $server = Koha::SMTP::Servers->get_default; |
37 |
is( ref($server), 'Koha::SMTP::Server', |
39 |
is( ref($server), 'Koha::SMTP::Server', |
38 |
'An object of the right type is returned' ); |
40 |
'An object of the right type is returned' ); |
Lines 48-52
subtest 'get_default() tests' => sub {
Link Here
|
48 |
'The default setting is returned if no user-defined default' |
50 |
'The default setting is returned if no user-defined default' |
49 |
); |
51 |
); |
50 |
|
52 |
|
|
|
53 |
t::lib::Mocks::mock_config( |
54 |
'smtp_server', |
55 |
{ |
56 |
host => 'localhost.midway', |
57 |
port => 1234, |
58 |
timeout => 121, |
59 |
ssl_mode => 'starttls', |
60 |
user_name => 'tomasito', |
61 |
password => 'none', |
62 |
debug => 1 |
63 |
} |
64 |
); |
65 |
|
66 |
my $smtp_config = C4::Context->config('smtp_server'); |
67 |
|
68 |
$server = Koha::SMTP::Servers->get_default; |
69 |
is( ref($server), 'Koha::SMTP::Server', |
70 |
'An object of the right type is returned' ); |
71 |
|
72 |
$unblessed_server = $server->unblessed; |
73 |
delete $unblessed_server->{id}; |
74 |
is_deeply( |
75 |
$unblessed_server, |
76 |
$smtp_config, |
77 |
'The default setting is overridden by the entry in koha-conf.xml' |
78 |
); |
79 |
|
51 |
$schema->storage->txn_rollback; |
80 |
$schema->storage->txn_rollback; |
52 |
}; |
81 |
}; |
53 |
- |
|
|