|
Lines 30-36
use Koha::AtomicUpdater;
Link Here
|
| 30 |
|
30 |
|
| 31 |
use t::lib::TestBuilder; |
31 |
use t::lib::TestBuilder; |
| 32 |
|
32 |
|
| 33 |
plan tests => 8; |
33 |
plan tests => 9; |
| 34 |
|
34 |
|
| 35 |
my $schema = Koha::Database->new->schema; |
35 |
my $schema = Koha::Database->new->schema; |
| 36 |
$schema->storage->txn_begin; |
36 |
$schema->storage->txn_begin; |
|
Lines 271-276
subtest "Apply single atomicupdate from file" => sub {
Link Here
|
| 271 |
|
271 |
|
| 272 |
}; |
272 |
}; |
| 273 |
|
273 |
|
|
|
274 |
subtest 'Mark all atomicupdates as installed (for fresh installs), but do not execute them' => sub { |
| 275 |
|
| 276 |
plan tests => 3; |
| 277 |
|
| 278 |
my $test_file1 = create_file({ |
| 279 |
filepath => 'atomicupdate/', |
| 280 |
filename => 'Bug_00001-First-update.pl', |
| 281 |
content => '$ENV{ATOMICUPDATE_TESTS_3}++;', |
| 282 |
|
| 283 |
}); |
| 284 |
|
| 285 |
my $test_file2 = create_file({ |
| 286 |
filepath => 'atomicupdate/', |
| 287 |
filename => 'Bug_00002-Second-update.pl', |
| 288 |
content => '$ENV{ATOMICUPDATE_TESTS_3}++;', |
| 289 |
}); |
| 290 |
|
| 291 |
my $atomicUpdater = Koha::AtomicUpdater->new({ |
| 292 |
scriptDir => $test_file1->dirname(), |
| 293 |
}); |
| 294 |
|
| 295 |
$atomicUpdater->addAllAtomicUpdates; |
| 296 |
my $atomicUpdate = $atomicUpdater->find('Bug-00001'); |
| 297 |
my $atomicUpdate2 = $atomicUpdater->find('Bug-00002'); |
| 298 |
|
| 299 |
is($atomicUpdate->filename, "Bug_00001-First-update.pl", "Bug_00001-First-update.pl added to DB"); |
| 300 |
is($atomicUpdate2->filename, "Bug_00002-Second-update.pl", "Bug_00002-Second-update.pl added to DB"); |
| 301 |
is($ENV{ATOMICUPDATE_TESTS_3}, undef, "However, updates were not executed."); |
| 302 |
|
| 303 |
$test_file1->remove; |
| 304 |
$test_file2->remove; |
| 305 |
}; |
| 306 |
|
| 274 |
$test_file->remove; |
307 |
$test_file->remove; |
| 275 |
$schema->storage->txn_rollback; |
308 |
$schema->storage->txn_rollback; |
| 276 |
|
309 |
|
| 277 |
- |
|
|