source: trunk/client/inc/hpdf5/spipu/html2pdf/src/Tests/Output/FileNameOkTest.php

Last change on this file was 347, checked in by roby, 4 years ago

Aggiornamento per compatibilità con php7.4

File size: 1.4 KB
RevLine 
[347]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
13namespace Spipu\Html2Pdf\Tests\Output;
14
15use Spipu\Html2Pdf\Html2Pdf;
16use Spipu\Html2Pdf\Tests\AbstractTest;
17
18/**
19 * Class FileNameOkTest
20 */
21class FileNameOkTest extends AbstractTest
22{
23 /**
24 * test: the file extension must be PDF - OK
25 *
26 * @return void
27 */
28 public function testOk()
29 {
30 $object = $this->getObject();
31 $object->writeHTML('Hello World');
32
33 ob_start();
34 $object->output('test.pdf');
35 $result = ob_get_clean();
36
37 $this->assertContains('PhpUnit Test', $result);
38 }
39
40 /**
41 * test: the file extension is ignored if output string
42 *
43 * @return void
44 */
45 public function testIgnore()
46 {
47 $object = $this->getObject();
48 $object->writeHTML('Hello World');
49 $result = $object->output('test.bad', 'S');
50
51 $this->assertContains('PhpUnit Test', $result);
52 }
53
54 /**
55 * test: the file extension must be PDF - Error
56 *
57 * @return void
58 * @expectedException \Spipu\Html2Pdf\Exception\Html2PdfException
59 */
60 public function testError()
61 {
62 $object = $this->getObject();
63 $object->writeHTML('<p>Hello World</p>');
64 $object->output('test.bad');
65 }
66}
Note: See TracBrowser for help on using the repository browser.