ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilPageFormatsTest.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
25 {
26  public function testFetchFormats(): void
27  {
28  $languageMock = $this->getMockBuilder(ilLanguage::class)
29  ->disableOriginalConstructor()
30  ->onlyMethods(['txt'])
31  ->getMock();
32 
33  $languageMock->method('txt')
34  ->withConsecutive(
35  ['certificate_a4'],
36  ['certificate_a4_landscape'],
37  ['certificate_a5'],
38  ['certificate_a5_landscape'],
39  ['certificate_letter'],
40  ['certificate_letter_landscape'],
41  ['certificate_custom']
42  )
43  ->willReturn('Some Translation');
44 
45  $pageFormats = new ilPageFormats($languageMock);
46 
47  $formats = $pageFormats->fetchPageFormats();
48 
49  $this->assertSame('a4', $formats['a4']['value']);
50  $this->assertSame('210mm', $formats['a4']['width']);
51 
52  $this->assertSame('297mm', $formats['a4']['height']);
53  $this->assertSame('Some Translation', $formats['a4']['name']);
54 
55  $this->assertSame('a4landscape', $formats['a4landscape']['value']);
56  $this->assertSame('297mm', $formats['a4landscape']['width']);
57  $this->assertSame('210mm', $formats['a4landscape']['height']);
58  $this->assertSame('Some Translation', $formats['a4landscape']['name']);
59 
60  $this->assertSame('a5', $formats['a5']['value']);
61  $this->assertSame('148mm', $formats['a5']['width']);
62  $this->assertSame('210mm', $formats['a5']['height']);
63  $this->assertSame('Some Translation', $formats['a5']['name']);
64 
65  $this->assertSame('a5landscape', $formats['a5landscape']['value']);
66  $this->assertSame('210mm', $formats['a5landscape']['width']);
67  $this->assertSame('148mm', $formats['a5landscape']['height']);
68  $this->assertSame('Some Translation', $formats['a5landscape']['name']);
69 
70  $this->assertSame('letter', $formats['letter']['value']);
71  $this->assertSame('8.5in', $formats['letter']['width']);
72  $this->assertSame('11in', $formats['letter']['height']);
73  $this->assertSame('Some Translation', $formats['letter']['name']);
74 
75  $this->assertSame('letterlandscape', $formats['letterlandscape']['value']);
76  $this->assertSame('11in', $formats['letterlandscape']['width']);
77  $this->assertSame('8.5in', $formats['letterlandscape']['height']);
78  $this->assertSame('Some Translation', $formats['letterlandscape']['name']);
79 
80  $this->assertSame('custom', $formats['custom']['value']);
81  $this->assertSame('', $formats['custom']['width']);
82  $this->assertSame('', $formats['custom']['height']);
83  $this->assertSame('Some Translation', $formats['custom']['name']);
84  }
85 }
Class ilCertificateBaseTestCase.
$formats
Definition: date.php:77