refactor layouts module to domain/di and prepare 0.256 release
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user