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:
@@ -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']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user