Lines 326-330
sub applySingleAtomicUpdateFromFile {
Link Here
|
326 |
t::lib::TestObjects::ObjectFactory->tearDownTestContext($subtestContext); |
326 |
t::lib::TestObjects::ObjectFactory->tearDownTestContext($subtestContext); |
327 |
} |
327 |
} |
328 |
|
328 |
|
|
|
329 |
subtest 'Mark all atomicupdates as installed (for fresh installs), but do not' |
330 |
.' execute them' => \&addAllAtomicUpdates; |
331 |
sub addAllAtomicUpdates { |
332 |
my $subtestContext = {}; |
333 |
eval { |
334 |
my $files = t::lib::TestObjects::FileFactory->createTestGroup([ |
335 |
{ |
336 |
filepath => 'atomicupdate/', |
337 |
filename => 'Bug_00001-First-update.pl', |
338 |
content => '$ENV{ATOMICUPDATE_TESTS_3}++;', |
339 |
}, |
340 |
{ |
341 |
filepath => 'atomicupdate/', |
342 |
filename => 'Bug_00002-Second-update.pl', |
343 |
content => '$ENV{ATOMICUPDATE_TESTS_3}++;', |
344 |
}, |
345 |
], |
346 |
undef, $subtestContext, $testContext); |
347 |
|
348 |
my $atomicUpdater = Koha::AtomicUpdater->new({ |
349 |
scriptDir => $files->{'Bug_00001-First-update.pl'}->dirname(), |
350 |
}); |
351 |
|
352 |
$atomicUpdater->addAllAtomicUpdates; |
353 |
my $atomicUpdate = $atomicUpdater->find('Bug-00001'); |
354 |
my $atomicUpdate2 = $atomicUpdater->find('Bug-00002'); |
355 |
t::lib::TestObjects::AtomicUpdateFactory->addToContext($atomicUpdate, undef, |
356 |
$subtestContext, $testContext); |
357 |
t::lib::TestObjects::AtomicUpdateFactory->addToContext($atomicUpdate2, undef, |
358 |
$subtestContext, $testContext); |
359 |
|
360 |
is($atomicUpdate->filename, |
361 |
"Bug_00001-First-update.pl", |
362 |
"Bug_00001-First-update.pl added to DB"); |
363 |
is($atomicUpdate2->filename, |
364 |
"Bug_00002-Second-update.pl", |
365 |
"Bug_00002-Second-update.pl added to DB"); |
366 |
is($ENV{ATOMICUPDATE_TESTS_3}, undef, "However, updates were not executed."); |
367 |
}; |
368 |
if ($@) { |
369 |
ok(0, $@); |
370 |
} |
371 |
t::lib::TestObjects::ObjectFactory->tearDownTestContext($subtestContext); |
372 |
} |
373 |
|
329 |
t::lib::TestObjects::ObjectFactory->tearDownTestContext($testContext); |
374 |
t::lib::TestObjects::ObjectFactory->tearDownTestContext($testContext); |
330 |
done_testing; |
375 |
done_testing; |
331 |
- |
|
|