refactor layouts module to domain/di and prepare 0.256 release

This commit is contained in:
2026-02-12 22:54:47 +01:00
parent 58a41691e6
commit b0a2f4be0e
24 changed files with 970 additions and 315 deletions

View File

@@ -112,5 +112,37 @@ class LanguagesRepositoryTest extends TestCase
$this->assertCount(1, $result['items']);
$this->assertSame('pl', $result['items'][0]['id']);
}
}
public function testDefaultLanguageIdReturnsLanguageWithStartFlag(): void
{
$mockDb = $this->createMock(\medoo::class);
$mockDb->expects($this->once())
->method('select')
->with('pp_langs', '*', ['ORDER' => ['o' => 'ASC']])
->willReturn([
['id' => 'en', 'start' => 0],
['id' => 'pl', 'start' => 1],
]);
$repository = new LanguagesRepository($mockDb);
$this->assertSame('pl', $repository->defaultLanguageId());
}
public function testDefaultLanguageIdFallsBackToFirstLanguageOrPl(): void
{
$mockDb = $this->createMock(\medoo::class);
$mockDb->expects($this->exactly(2))
->method('select')
->with('pp_langs', '*', ['ORDER' => ['o' => 'ASC']])
->willReturnOnConsecutiveCalls(
[
['id' => 'en', 'start' => 0],
],
[]
);
$repository = new LanguagesRepository($mockDb);
$this->assertSame('en', $repository->defaultLanguageId());
$this->assertSame('pl', $repository->defaultLanguageId());
}
}