html2pdf mit composer hinzugefügt
This commit is contained in:
61
vendor/spipu/html2pdf/Tests/Parsing/HtmlTest.php
vendored
Normal file
61
vendor/spipu/html2pdf/Tests/Parsing/HtmlTest.php
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/**
|
||||
* Html2Pdf Library - Tests
|
||||
*
|
||||
* HTML => PDF converter
|
||||
* distributed under the OSL-3.0 License
|
||||
*
|
||||
* @package Html2pdf
|
||||
* @author Laurent MINGUET <webmaster@html2pdf.fr>
|
||||
* @copyright 2017 Laurent MINGUET
|
||||
*/
|
||||
|
||||
namespace Spipu\Html2Pdf\Tests\Parsing;
|
||||
|
||||
use Spipu\Html2Pdf\Tests\CrossVersionCompatibility\HtmlTestCase;
|
||||
|
||||
/**
|
||||
* Class HtmlTest
|
||||
*/
|
||||
class HtmlTest extends HtmlTestCase
|
||||
{
|
||||
/**
|
||||
* mock of prepareTxt method
|
||||
*
|
||||
* @param $txt
|
||||
* @param bool $spaces
|
||||
* @return mixed
|
||||
*/
|
||||
public function mockPrepareTxt($txt, $spaces = true)
|
||||
{
|
||||
return $txt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the prepareHtml method
|
||||
*/
|
||||
public function testPrepareHtml()
|
||||
{
|
||||
$result = $this->object->prepareHtml('Hello [[date_y]]-[[date_m]]-[[date_d]] World');
|
||||
$this->assertSame('Hello '.date('Y-m-d').' World', $result);
|
||||
|
||||
$result = $this->object->prepareHtml('Hello [[date_h]]:[[date_i]]:[[date_s]] World');
|
||||
$this->assertSame('Hello '.date('H:i:s').' World', $result);
|
||||
|
||||
$html = '
|
||||
<html>
|
||||
<head>
|
||||
<style type="text">.my-class { color: red; }</style>
|
||||
<link type="text/css" href="my-style.css"/>
|
||||
</head>
|
||||
<body class="my-class"><p>Hello World</p></body>
|
||||
</html>';
|
||||
|
||||
$expected='<style type="text">.my-class { color: red; }</style>'.
|
||||
'<link type="text/css" href="my-style.css"/>'.
|
||||
'<page class="my-class"><p>Hello World</p></page>';
|
||||
|
||||
$result = $this->object->prepareHtml($html);
|
||||
$this->assertSame($expected, $result);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user