fix(portal): preserve territorial totals and legacy redirect context
This commit is contained in:
@@ -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');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user