fix(portal): preserve territorial totals and legacy redirect context

This commit is contained in:
2026-11-10 10:41:46 +02:00
parent 2209b83820
commit 377c40a21a
15 changed files with 686 additions and 20 deletions
+3 -3
View File
@@ -20,15 +20,15 @@ class PublicPortalNavigationTest extends TestCase
Opportunity::create(['sector_id' => $sector->id, 'reference' => 'CACHE-1', 'title' => 'Solar',
'slug' => 'solar', 'status' => 'published', 'published_at' => now()->subMinute(), 'is_featured' => true]);
$first = $this->getJson('/api/v1/home')->assertOk()->json();
$cached = Cache::get('portal_home_sector_organization_v1_pt');
$cached = Cache::get('portal_home_territorial_v2_pt');
$this->assertIsArray($cached['sectors']);
$this->assertIsArray($cached['featuredOpportunities']);
$restored = unserialize(serialize($cached), ['allowed_classes' => false]);
$this->assertSame($cached, $restored);
Cache::put('portal_home_sector_organization_v1_pt', $restored);
Cache::put('portal_home_territorial_v2_pt', $restored);
$this->assertSame($first, $this->getJson('/api/v1/home')->assertOk()->json());
$sector->update(['name' => 'Energia actualizada']);
$this->assertNull(Cache::get('portal_home_sector_organization_v1_pt'));
$this->assertNull(Cache::get('portal_home_territorial_v2_pt'));
$this->getJson('/api/v1/home')->assertJsonPath('data.sectors.0.name', 'Energia actualizada');
}