38 lines
1.2 KiB
PHP
38 lines
1.2 KiB
PHP
<?php
|
|
|
|
use Illuminate\Console\Command;
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Facades\Storage;
|
|
use Tests\TestCase;
|
|
|
|
test('legacy verify succeeds for an empty but consistent target database', function () {
|
|
/** @var TestCase $this */
|
|
Storage::fake('local');
|
|
|
|
$this->artisan('legacy:verify', ['--skip-legacy' => true])
|
|
->assertSuccessful()
|
|
->expectsOutputToContain('Legacy-DB-Checks werden übersprungen.')
|
|
->expectsOutputToContain('OK import_map_targets')
|
|
->expectsOutputToContain('OK target_foreign_keys');
|
|
|
|
expect(Storage::disk('local')->files('migration'))->toHaveCount(1);
|
|
});
|
|
|
|
test('legacy verify fails when an import map points to a missing target row', function () {
|
|
/** @var TestCase $this */
|
|
DB::table('legacy_import_map')->insert([
|
|
'legacy_portal' => 'presseecho',
|
|
'legacy_table' => 'sf_guard_user',
|
|
'legacy_id' => 123,
|
|
'target_table' => 'users',
|
|
'target_id' => 999_999,
|
|
'imported_at' => now(),
|
|
]);
|
|
|
|
$this->artisan('legacy:verify', [
|
|
'--skip-legacy' => true,
|
|
'--no-report' => true,
|
|
])
|
|
->assertExitCode(Command::FAILURE)
|
|
->expectsOutputToContain('FAIL import_map_targets');
|
|
});
|