ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilPageFormatsTest.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
8 {
9  public function testFetchFormats()
10  {
11  $languageMock = $this->getMockBuilder('ilLanguage')
12  ->disableOriginalConstructor()
13  ->setMethods(array('txt'))
14  ->getMock();
15 
16  $languageMock->method('txt')
17  ->withConsecutive(
18  array('certificate_a4'),
19  array('certificate_a4_landscape'),
20  array('certificate_a5'),
21  array('certificate_a5_landscape'),
22  array('certificate_letter'),
23  array('certificate_letter_landscape'),
24  array('certificate_custom')
25  )
26  ->willReturn('Some Translation');
27 
28  $pageFormats = new ilPageFormats($languageMock);
29 
30  $formats = $pageFormats->fetchPageFormats();
31 
32  $this->assertEquals('a4', $formats['a4']['value']);
33  $this->assertEquals('210mm', $formats['a4']['width']);
34 
35  $this->assertEquals('297mm', $formats['a4']['height']);
36  $this->assertEquals('Some Translation', $formats['a4']['name']);
37 
38  $this->assertEquals('a4landscape', $formats['a4landscape']['value']);
39  $this->assertEquals('297mm', $formats['a4landscape']['width']);
40  $this->assertEquals('210mm', $formats['a4landscape']['height']);
41  $this->assertEquals('Some Translation', $formats['a4landscape']['name']);
42 
43  $this->assertEquals('a5', $formats['a5']['value']);
44  $this->assertEquals('148mm', $formats['a5']['width']);
45  $this->assertEquals('210mm', $formats['a5']['height']);
46  $this->assertEquals('Some Translation', $formats['a5']['name']);
47 
48  $this->assertEquals('a5landscape', $formats['a5landscape']['value']);
49  $this->assertEquals('210mm', $formats['a5landscape']['width']);
50  $this->assertEquals('148mm', $formats['a5landscape']['height']);
51  $this->assertEquals('Some Translation', $formats['a5landscape']['name']);
52 
53  $this->assertEquals('letter', $formats['letter']['value']);
54  $this->assertEquals('8.5in', $formats['letter']['width']);
55  $this->assertEquals('11in', $formats['letter']['height']);
56  $this->assertEquals('Some Translation', $formats['letter']['name']);
57 
58  $this->assertEquals('letterlandscape', $formats['letterlandscape']['value']);
59  $this->assertEquals('11in', $formats['letterlandscape']['width']);
60  $this->assertEquals('8.5in', $formats['letterlandscape']['height']);
61  $this->assertEquals('Some Translation', $formats['letterlandscape']['name']);
62 
63  $this->assertEquals('custom', $formats['custom']['value']);
64  $this->assertEquals('', $formats['custom']['width']);
65  $this->assertEquals('', $formats['custom']['height']);
66  $this->assertEquals('Some Translation', $formats['custom']['name']);
67  }
68 }
$formats
Definition: date.php:77