Skip to content

Commit 9718fd4

Browse files
committed
better unit tests
1 parent 17f53d1 commit 9718fd4

56 files changed

Lines changed: 218 additions & 140 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [5.2.7](https://github.com/spipu/html2pdf/compare/v5.2.6...v5.2.7) - 2023-02-02
6+
7+
* fix phunit compatibility
8+
59
## [5.2.6](https://github.com/spipu/html2pdf/compare/v5.2.5...v5.2.6) - 2023-01-28
610

711
* add support of PHP 8.1 and PHP 8.2

phpunit.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
33
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
4-
bootstrap="./src/Tests/bootstrap.php"
4+
bootstrap="./src/Tests/CrossVersionCompatibility/bootstrap.php"
55
colors="true"
66
backupGlobals="false"
77
backupStaticAttributes="false"

src/Html2Pdf.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ public function getVersionAsArray()
247247
return array(
248248
'major' => 5,
249249
'minor' => 2,
250-
'revision' => 6
250+
'revision' => 7
251251
);
252252
}
253253

src/Tests/AbstractTest.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,12 @@
33
namespace Spipu\Html2Pdf\Tests;
44

55
use Spipu\Html2Pdf\Html2Pdf;
6-
7-
if (HTML2PDF_PHPUNIT_VERSION === 9) {
8-
require_once 'CrossVersionCompatibility/PhpUnit9/AbstractTestCase.php';
9-
} else {
10-
require_once 'CrossVersionCompatibility/PhpUnit5/AbstractTestCase.php';
11-
}
6+
use Spipu\Html2Pdf\Tests\CrossVersionCompatibility\AbstractTestCase;
127

138
/**
149
* Class AbstractTest
1510
*/
16-
abstract class AbstractTest extends \Spipu\Html2Pdf\Tests\CrossVersionCompatibility\AbstractTestCase
11+
abstract class AbstractTest extends AbstractTestCase
1712
{
1813
/**
1914
* Get the object to test
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace Spipu\Html2Pdf\Tests\CrossVersionCompatibility;
4+
5+
if (HTML2PDF_PHPUNIT_VERSION === 9) {
6+
abstract class AbstractTestCase extends \Spipu\Html2Pdf\Tests\CrossVersionCompatibility\PhpUnit9\AbstractTestCase
7+
{
8+
}
9+
} else {
10+
abstract class AbstractTestCase extends \Spipu\Html2Pdf\Tests\CrossVersionCompatibility\PhpUnit5\AbstractTestCase
11+
{
12+
}
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace Spipu\Html2Pdf\Tests\CrossVersionCompatibility;
4+
5+
if (HTML2PDF_PHPUNIT_VERSION === 9) {
6+
abstract class CssConverterTestCase extends \Spipu\Html2Pdf\Tests\CrossVersionCompatibility\PhpUnit9\CssConverterTestCase
7+
{
8+
}
9+
} else {
10+
abstract class CssConverterTestCase extends \Spipu\Html2Pdf\Tests\CrossVersionCompatibility\PhpUnit5\CssConverterTestCase
11+
{
12+
}
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace Spipu\Html2Pdf\Tests\CrossVersionCompatibility;
4+
5+
if (HTML2PDF_PHPUNIT_VERSION === 9) {
6+
abstract class ExceptionFormatterTestCase extends \Spipu\Html2Pdf\Tests\CrossVersionCompatibility\PhpUnit9\ExceptionFormatterTestCase
7+
{
8+
}
9+
} else {
10+
abstract class ExceptionFormatterTestCase extends \Spipu\Html2Pdf\Tests\CrossVersionCompatibility\PhpUnit5\ExceptionFormatterTestCase
11+
{
12+
}
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace Spipu\Html2Pdf\Tests\CrossVersionCompatibility;
4+
5+
if (HTML2PDF_PHPUNIT_VERSION === 9) {
6+
abstract class HtmlTestCase extends \Spipu\Html2Pdf\Tests\CrossVersionCompatibility\PhpUnit9\HtmlTestCase
7+
{
8+
}
9+
} else {
10+
abstract class HtmlTestCase extends \Spipu\Html2Pdf\Tests\CrossVersionCompatibility\PhpUnit5\HtmlTestCase
11+
{
12+
}
13+
}

src/Tests/CrossVersionCompatibility/PhpUnit5/AbstractTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Spipu\Html2Pdf\Tests\CrossVersionCompatibility;
3+
namespace Spipu\Html2Pdf\Tests\CrossVersionCompatibility\PhpUnit5;
44

55
use Spipu\Html2Pdf\Html2Pdf;
66

src/Tests/CrossVersionCompatibility/PhpUnit5/CssConverterTestCase.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
<?php
22

3-
namespace Spipu\Html2Pdf\Tests\CrossVersionCompatibility;
3+
namespace Spipu\Html2Pdf\Tests\CrossVersionCompatibility\PhpUnit5;
44

5+
use PHPUnit_Framework_TestCase;
56
use Spipu\Html2Pdf\CssConverter;
67

7-
abstract class CssConverterTestCase extends \PHPUnit_Framework_TestCase
8+
abstract class CssConverterTestCase extends PHPUnit_Framework_TestCase
89
{
910
/**
1011
* @var CssConverter
1112
*/
1213
protected $cssConverter;
1314

14-
public function setUp()
15+
protected function setUp()
1516
{
1617
$this->cssConverter = new CssConverter();
1718
}

0 commit comments

Comments
 (0)