Last change
on this file was 347, checked in by roby, 4 years ago |
Aggiornamento per compatibilità con php7.4
|
File size:
1.6 KB
|
Line | |
---|
1 | <?php
|
---|
2 | /**
|
---|
3 | * Html2Pdf Library - Tests
|
---|
4 | *
|
---|
5 | * HTML => PDF converter
|
---|
6 | * distributed under the OSL-3.0 License
|
---|
7 | *
|
---|
8 | * @package Html2pdf
|
---|
9 | * @author Laurent MINGUET <webmaster@html2pdf.fr>
|
---|
10 | * @copyright 2017 Laurent MINGUET
|
---|
11 | */
|
---|
12 |
|
---|
13 | namespace Spipu\Html2Pdf\Tests;
|
---|
14 |
|
---|
15 | use Spipu\Html2Pdf\Locale;
|
---|
16 | use Spipu\Html2Pdf\Exception\LocaleException;
|
---|
17 |
|
---|
18 | /**
|
---|
19 | * Class LocaleTest
|
---|
20 | */
|
---|
21 | class LocaleTest extends \PHPUnit_Framework_TestCase
|
---|
22 | {
|
---|
23 | /**
|
---|
24 | * test bad code
|
---|
25 | *
|
---|
26 | * @return void
|
---|
27 | * @expectedException \Spipu\Html2Pdf\Exception\LocaleException
|
---|
28 | */
|
---|
29 | public function testBadCode()
|
---|
30 | {
|
---|
31 | Locale::clean();
|
---|
32 |
|
---|
33 | try {
|
---|
34 | Locale::load('$aa');
|
---|
35 | } catch (LocaleException $e) {
|
---|
36 | $this->assertSame('$aa', $e->getLocalCode());
|
---|
37 | throw $e;
|
---|
38 | }
|
---|
39 | }
|
---|
40 |
|
---|
41 | /**
|
---|
42 | * test unknown code
|
---|
43 | *
|
---|
44 | * @return void
|
---|
45 | * @expectedException \Spipu\Html2Pdf\Exception\LocaleException
|
---|
46 | */
|
---|
47 | public function testUnknownCode()
|
---|
48 | {
|
---|
49 | Locale::clean();
|
---|
50 | try {
|
---|
51 | Locale::load('aa');
|
---|
52 | } catch (LocaleException $e) {
|
---|
53 | $this->assertSame('aa', $e->getLocalCode());
|
---|
54 | throw $e;
|
---|
55 | }
|
---|
56 | }
|
---|
57 |
|
---|
58 | /**
|
---|
59 | * test good code
|
---|
60 | *
|
---|
61 | * @return void
|
---|
62 | */
|
---|
63 | public function testGoodCode()
|
---|
64 | {
|
---|
65 | Locale::clean();
|
---|
66 | Locale::load('en');
|
---|
67 |
|
---|
68 | $this->assertSame('Page [[page_cu]]/[[page_nb]]', Locale::get('pdf04'));
|
---|
69 | $this->assertSame('bad_return', Locale::get('bad_code', 'bad_return'));
|
---|
70 | Locale::clean();
|
---|
71 | $this->assertSame('bad_return', Locale::get('pdf04', 'bad_return'));
|
---|
72 | }
|
---|
73 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.