ver. 0.287: Scontainers + ShopAttribute frontend migration to Domain

- Scontainers: frontScontainerDetails() with Redis cache in ScontainersRepository
- Scontainers: new front\Views\Scontainers VIEW, deleted factory + view legacy
- ShopAttribute: frontAttributeDetails(), frontValueDetails() with Redis cache in AttributeRepository
- ShopAttribute: clearFrontCache() per attribute/value + language
- ShopAttribute: deleted front\factory\ShopAttribute, updated 4 callers
- Tests: 476 OK, 1512 assertions (+6 frontend tests)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-17 08:47:21 +01:00
parent 8162df7356
commit 3b50ba7990
22 changed files with 314 additions and 125 deletions

View File

@@ -59,5 +59,40 @@ class ScontainersRepositoryTest extends TestCase
$this->assertNull($repository->detailsForLanguage(0, 'pl'));
$this->assertNull($repository->detailsForLanguage(1, ''));
}
// ── Frontend methods tests ──────────────────────────────────
public function testFrontScontainerDetailsReturnsContainerWithLanguage(): void
{
$mockDb = $this->createMock(\medoo::class);
$mockDb->expects($this->exactly(2))
->method('get')
->willReturnOnConsecutiveCalls(
['id' => 3, 'status' => 1, 'show_title' => 1],
['container_id' => 3, 'lang_id' => 'pl', 'title' => 'Tytul', 'text' => 'Tekst']
);
$repository = new ScontainersRepository($mockDb);
$result = $repository->frontScontainerDetails(3, 'pl');
$this->assertIsArray($result);
$this->assertSame(3, (int)$result['id']);
$this->assertSame(1, (int)$result['status']);
$this->assertSame('Tytul', $result['languages']['title']);
}
public function testFrontScontainerDetailsReturnsFallbackForNotFound(): void
{
$mockDb = $this->createMock(\medoo::class);
$mockDb->method('get')->willReturn(null);
$repository = new ScontainersRepository($mockDb);
$result = $repository->frontScontainerDetails(999, 'pl');
$this->assertIsArray($result);
$this->assertSame(999, (int)$result['id']);
$this->assertSame(0, (int)$result['status']);
$this->assertSame('pl', $result['languages']['lang_id']);
}
}