html2pdf mit composer hinzugefügt

This commit is contained in:
aschwarz
2023-02-16 09:19:46 +01:00
parent 3dcc93a65d
commit d1ab7f3763
613 changed files with 134681 additions and 0 deletions

View File

@ -0,0 +1,47 @@
<?php
namespace Spipu\Html2Pdf\Tests\CrossVersionCompatibility\PhpUnit5;
use Spipu\Html2Pdf\Html2Pdf;
abstract class AbstractTestCase extends \PHPUnit_Framework_TestCase
{
/**
* @var Html2Pdf
*/
protected $html2pdf;
/**
* Executed before each test
*/
protected function setUp()
{
$this->html2pdf = new Html2Pdf('P', 'A4', 'fr', true, 'UTF-8', [0, 0, 0, 0]);
$this->html2pdf->pdf->SetTitle('PhpUnit Test');
}
/**
* Executed after each test
*/
protected function tearDown()
{
$this->html2pdf->clean();
$this->html2pdf = null;
}
public function expectException($exception)
{
if (method_exists(\PHPUnit_Framework_TestCase::class, 'setExpectedException')) {
$this->setExpectedException($exception);
}
}
public function expectExceptionMessage($message, $exception = null)
{
if (method_exists(\PHPUnit_Framework_TestCase::class, 'expectExceptionMessage')) {
parent::expectExceptionMessage($message);
} elseif (method_exists(\PHPUnit_Framework_TestCase::class, 'setExpectedException')) {
$this->setExpectedException($exception, $message);
}
}
}

View File

@ -0,0 +1,19 @@
<?php
namespace Spipu\Html2Pdf\Tests\CrossVersionCompatibility\PhpUnit5;
use PHPUnit_Framework_TestCase;
use Spipu\Html2Pdf\CssConverter;
abstract class CssConverterTestCase extends PHPUnit_Framework_TestCase
{
/**
* @var CssConverter
*/
protected $cssConverter;
protected function setUp()
{
$this->cssConverter = new CssConverter();
}
}

View File

@ -0,0 +1,19 @@
<?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\CrossVersionCompatibility\PhpUnit5;
use PHPUnit_Framework_TestCase;
abstract class ExceptionFormatterTestCase extends PHPUnit_Framework_TestCase
{
}

View File

@ -0,0 +1,39 @@
<?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\CrossVersionCompatibility\PhpUnit5;
use PHPUnit_Framework_TestCase;
use Spipu\Html2Pdf\Parsing\Html;
abstract class HtmlTestCase extends PHPUnit_Framework_TestCase
{
/**
* @var Html
*/
protected $object;
protected function setUp()
{
$textParser = $this->getMockBuilder('Spipu\Html2Pdf\Parsing\TextParser')
->disableOriginalConstructor()
->setMethods(['prepareTxt'])
->getMock();
$textParser
->expects($this->any())
->method('prepareTxt')
->will($this->returnCallback([$this, 'mockPrepareTxt']));
$this->object = new Html($textParser);
}
}

View File

@ -0,0 +1,24 @@
<?php
namespace Spipu\Html2Pdf\Tests\CrossVersionCompatibility\PhpUnit5;
use PHPUnit_Framework_TestCase;
use Spipu\Html2Pdf\CssConverter;
use Spipu\Html2Pdf\SvgDrawer;
abstract class SvgDrawerTestCase extends PHPUnit_Framework_TestCase
{
/**
* @var SvgDrawer
*/
protected $svgDrawer;
protected function setUp()
{
$myPdf = $this->createMock('Spipu\Html2Pdf\MyPdf');
$cssConverter = new CssConverter();
$this->svgDrawer = new SvgDrawer($myPdf, $cssConverter);
}
}

View File

@ -0,0 +1,39 @@
<?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\CrossVersionCompatibility\PhpUnit5;
use PHPUnit_Framework_TestCase;
use Spipu\Html2Pdf\Parsing\TagParser;
abstract class TagParserTestCase extends PHPUnit_Framework_TestCase
{
/**
* @var TagParser
*/
protected $parser;
protected function setUp()
{
$textParser = $this->getMockBuilder('Spipu\Html2Pdf\Parsing\TextParser')
->disableOriginalConstructor()
->setMethods(['prepareTxt'])
->getMock();
$textParser
->expects($this->any())
->method('prepareTxt')
->will($this->returnCallback([$this, 'mockPrepareTxt']));
$this->parser = new TagParser($textParser);
}
}

View File

@ -0,0 +1,29 @@
<?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\CrossVersionCompatibility\PhpUnit5;
use PHPUnit_Framework_TestCase;
use Spipu\Html2Pdf\Parsing\TextParser;
abstract class TextParserTestCase extends PHPUnit_Framework_TestCase
{
/**
* @var TextParser
*/
protected $parser;
protected function setUp()
{
$this->parser = new TextParser();
}
}