Team-Statistik: Neu-Badge-Link kannte $selectedTree nicht (ViewException auf Produktion)
Die Closure fuer den Link des gruenen "+N"-Badges band die neue Variable nicht per use ein; sobald eine Linie neue Abos zaehlte, brach die Uebersicht mit "Undefined variable $selectedTree" ab. Regressionstest rendert die Uebersicht mit einem neuen Teamabo und prueft den Badge-Link. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
96545364f1
commit
44637d06a7
3 changed files with 52 additions and 2 deletions
|
|
@ -8,6 +8,7 @@ use App\Models\UserSalesVolume;
|
|||
use App\Services\Abo\TeamAboOverviewService;
|
||||
use App\Services\Backoffice\BackofficeDashboardService;
|
||||
use App\Services\Backoffice\BackofficeDrilldownService;
|
||||
use App\Services\HTMLHelper;
|
||||
use App\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Illuminate\Support\Facades\URL;
|
||||
|
|
@ -337,3 +338,36 @@ it('haengt die Sortierwerte an die Zellen der Drilldown-Tabelle (A14)', function
|
|||
->toContain('data-sort-value="2026-12-10"')
|
||||
->toContain('data-sort-value="20"');
|
||||
});
|
||||
|
||||
it('rendert die Uebersicht mit dem Neu-Badge samt Baum-Parameter (Regression: Closure ohne $selectedTree)', function (): void {
|
||||
URL::resolveMissingNamedRoutesUsing(fn (string $name, $parameters = []) => '/'.$name.'?'.http_build_query($parameters));
|
||||
|
||||
$root = boMakeUser();
|
||||
$anna = boMakeUser($root->id, '2026-03-15');
|
||||
boMakeAbo($anna->id, 'me', '2026-06-10', 20);
|
||||
$this->actingAs($root);
|
||||
|
||||
$statistics = app(BackofficeDashboardService::class)->overview($root, 6, 2026);
|
||||
|
||||
expect($statistics['totals']['team_partner_abos_new'])->toBe(1);
|
||||
|
||||
// Das gruene "+1"-Badge wird nur gerendert, wenn es neue Abos gibt — erst dann
|
||||
// laeuft die Link-Closure, die auf Produktion mit "Undefined variable
|
||||
// $selectedTree" abbrach (14.09.2026).
|
||||
$html = view('user.backoffice.statistics.index', [
|
||||
'selectedMonth' => 6,
|
||||
'selectedYear' => 2026,
|
||||
'selectedTree' => BackofficeDashboardService::TREE_COMMISSION,
|
||||
'treeLabels' => BackofficeDashboardService::treeLabels(),
|
||||
'filterMonths' => HTMLHelper::getTransMonths(),
|
||||
'filterYears' => HTMLHelper::getYearRange(2022),
|
||||
'statistics' => $statistics,
|
||||
'performance' => ['duration_ms' => 1.0, 'source' => 'live', 'source_label' => 'Live', 'calculated_at' => null],
|
||||
'commission' => null,
|
||||
])->render();
|
||||
|
||||
expect($html)
|
||||
->toContain('backoffice-statistics-click-badge')
|
||||
->toContain('only_new=1')
|
||||
->toContain('tree=commission');
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue