19 declare(strict_types=1);
25 $languageMock = $this->getMockBuilder(ilLanguage::class)
26 ->disableOriginalConstructor()
27 ->onlyMethods([
'txt'])
30 $consecutive_returns = [
31 'certificate_a4' =>
'A4',
32 'certificate_a4_landscape' =>
'A4l',
33 'certificate_a5' =>
'A5',
34 'certificate_a5_landscape' =>
'A5l',
35 'certificate_letter' =>
'L',
36 'certificate_letter_landscape' =>
'Ll',
37 'certificate_custom' =>
'C',
39 $languageMock->method(
'txt')
40 ->willReturnCallback(fn($k) => $consecutive_returns[$k]);
44 $formats = $pageFormats->fetchPageFormats();
46 $this->assertSame(
'a4', $formats[
'a4'][
'value']);
47 $this->assertSame(
'210mm', $formats[
'a4'][
'width']);
49 $this->assertSame(
'297mm', $formats[
'a4'][
'height']);
50 $this->assertSame(
'A4', $formats[
'a4'][
'name']);
52 $this->assertSame(
'a4landscape', $formats[
'a4landscape'][
'value']);
53 $this->assertSame(
'297mm', $formats[
'a4landscape'][
'width']);
54 $this->assertSame(
'210mm', $formats[
'a4landscape'][
'height']);
55 $this->assertSame(
'A4l', $formats[
'a4landscape'][
'name']);
57 $this->assertSame(
'a5', $formats[
'a5'][
'value']);
58 $this->assertSame(
'148mm', $formats[
'a5'][
'width']);
59 $this->assertSame(
'210mm', $formats[
'a5'][
'height']);
60 $this->assertSame(
'A5', $formats[
'a5'][
'name']);
62 $this->assertSame(
'a5landscape', $formats[
'a5landscape'][
'value']);
63 $this->assertSame(
'210mm', $formats[
'a5landscape'][
'width']);
64 $this->assertSame(
'148mm', $formats[
'a5landscape'][
'height']);
65 $this->assertSame(
'A5l', $formats[
'a5landscape'][
'name']);
67 $this->assertSame(
'letter', $formats[
'letter'][
'value']);
68 $this->assertSame(
'8.5in', $formats[
'letter'][
'width']);
69 $this->assertSame(
'11in', $formats[
'letter'][
'height']);
70 $this->assertSame(
'L', $formats[
'letter'][
'name']);
72 $this->assertSame(
'letterlandscape', $formats[
'letterlandscape'][
'value']);
73 $this->assertSame(
'11in', $formats[
'letterlandscape'][
'width']);
74 $this->assertSame(
'8.5in', $formats[
'letterlandscape'][
'height']);
75 $this->assertSame(
'Ll', $formats[
'letterlandscape'][
'name']);
77 $this->assertSame(
'custom', $formats[
'custom'][
'value']);
78 $this->assertSame(
'', $formats[
'custom'][
'width']);
79 $this->assertSame(
'', $formats[
'custom'][
'height']);
80 $this->assertSame(
'C', $formats[
'custom'][
'name']);