|
Lines 17-24
Link Here
|
| 17 |
|
17 |
|
| 18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
| 19 |
|
19 |
|
| 20 |
use Test::More tests => 3; |
20 |
use Test::More tests => 4; |
| 21 |
use Test::NoWarnings; |
21 |
use Test::NoWarnings; |
|
|
22 |
use Test::MockModule; |
| 22 |
|
23 |
|
| 23 |
use t::lib::TestBuilder; |
24 |
use t::lib::TestBuilder; |
| 24 |
|
25 |
|
|
Lines 175-177
subtest 'config_timestamp is updated when database configuration changes' => sub
Link Here
|
| 175 |
|
176 |
|
| 176 |
$schema->storage->txn_rollback; |
177 |
$schema->storage->txn_rollback; |
| 177 |
}; |
178 |
}; |
| 178 |
- |
179 |
|
|
|
180 |
subtest 'Atomicupdate skips migrating data if provided config file doesn\'t exist or is unreadable' => sub { |
| 181 |
|
| 182 |
plan tests => 1; |
| 183 |
|
| 184 |
my $captured_message; |
| 185 |
my $mock = Test::MockModule->new('Koha::Installer::Output'); |
| 186 |
$mock->mock( |
| 187 |
'say_warning', |
| 188 |
sub { |
| 189 |
my ( $out_object, $message ) = @_; |
| 190 |
$captured_message = $message; |
| 191 |
} |
| 192 |
); |
| 193 |
|
| 194 |
my $koha_instance = $ENV{KOHA_CONF} =~ m!^.+/sites/([^/]+)/koha-conf\.xml$! ? $1 : undef; |
| 195 |
my $SIPconfigXMLFile = "/etc/koha/sites/$koha_instance/SIPconfig.xml"; |
| 196 |
my $fileSIPconfig = C4::SIP::Sip::Configuration->new($SIPconfigXMLFile); |
| 197 |
|
| 198 |
rename $SIPconfigXMLFile, "/etc/koha/sites/$koha_instance/IDontExist.xml"; |
| 199 |
my $db_rev_file = C4::Context->config('intranetdir') . '/installer/data/mysql/db_revs/250600035.pl'; |
| 200 |
C4::Installer::run_db_rev($db_rev_file); |
| 201 |
is( |
| 202 |
$captured_message, |
| 203 |
"Skipping migration. SIP config file not found or unreadable", |
| 204 |
'say_warning received the correct migration skip message' |
| 205 |
); |
| 206 |
rename "/etc/koha/sites/$koha_instance/IDontExist.xml", $SIPconfigXMLFile; |
| 207 |
} |