companies: Zusammenführungen zum Nachprüfen auflisten

companies:merges --batch= zeigt je Vorgang Überlebenden, Newsroom-URLs auf
beiden Portalen, aufgegangene Firmen und deren alte URLs (301). Der scharfe
Lauf gibt die ersten 30 Vorgänge jetzt ebenfalls als Tabelle aus.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Kevin Adametz 2026-09-15 09:10:54 +00:00
parent 1368e2cf07
commit 202cf340f9
4 changed files with 151 additions and 5 deletions

View file

@ -12,6 +12,7 @@ use App\Models\User;
use App\Services\Company\CompanyMergePlan;
use App\Services\Company\CompanyMergeService;
use App\Services\Company\CompanyMergeSkip;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\DB;
use Tests\TestCase;
@ -323,3 +324,24 @@ test('the same slug on both portals needs no redirect', function () {
$this->get('https://presseecho.test/de/newsroom/muster')->assertOk();
$this->get('https://businessportal24.test/de/newsroom/muster')->assertOk();
});
test('the merge list shows survivor, merged companies and the URLs to check', function () {
/** @var TestCase $this */
mergeGroup('info@muster.de');
mergeMember('info@muster.de', Portal::Businessportal24, 2, ['slug' => 'muster-gmbh']);
mergeMember('info@muster.de', Portal::Presseecho, 1, ['slug' => 'muster']);
$this->artisan('companies:merge')->assertSuccessful();
$batch = CompanyMerge::query()->value('batch');
Artisan::call('companies:merges', ['--batch' => $batch, '--json' => true]);
$listed = json_decode(Artisan::output(), true)[0];
expect($listed['newsroom'])->toBe(['https://presseecho.test/de/newsroom/muster-gmbh', 'https://businessportal24.test/de/newsroom/muster-gmbh'])
->and($listed['aufgegangen'][0]['alte_url'])->toBe(['https://presseecho.test/de/newsroom/muster'])
->and($listed['meldungen'])->toBe(1);
$this->artisan('companies:merges', ['--email' => 'INFO@muster.de'])
->expectsOutputToContain('muster-gmbh')
->assertSuccessful();
});