From 0c7645de1d80ec5be6f9965970d13ffc4d0dce09 Mon Sep 17 00:00:00 2001 From: Konrad Abicht Date: Thu, 9 Mar 2023 10:14:50 +0100 Subject: [PATCH] Fixes failing tests; reorganized test files (PHPUnit 10.x related) Since version 10, PHPUnit complains about: 1) Your XML configuration validates against a deprecated schema. Migrate your XML configuration using "--migrate-configuration"! 2) Class AltAutoloadTest cannot be found in D:\a\pdfparser\pdfparser\tests\AltAutoloadTest.php 3) Class Tests\Smalot\PdfParser\Performance\Test\AbstractPerformanceTest cannot be found in D:\a\pdfparser\pdfparser\tests\Performance\Test\AbstractPerformanceTest.php 4) Class Tests\Smalot\PdfParser\Performance\Test\DocumentDictionaryCacheTest cannot be found in D:\a\pdfparser\pdfparser\tests\Performance\Test\DocumentDictionaryCacheTest.php The first one is easy to solve. But the other 3 are confusing, because PHPUnit 9 did not complain at all. Reason for these warnings is that since PHPUnit v10, it doesn't like abstract Test classes or files (containing Test in the name), which contain no class at all. Source: https://github.com/sebastianbergmann/phpunit/issues/4979 To mitigate these warnings and to make maintenance easier in the future, I reorganized our test files and put them in different folders. PHPUnit tests are separated from our other tests. --- .github/workflows/continuous-integration.yml | 2 +- .gitignore | 1 + composer.json | 3 +- phpunit-windows.xml | 2 +- phpunit.xml | 50 +++++++------------ .../AltAutoloadCheck.php} | 2 +- .../{ => PHPUnit}/Integration/ConfigTest.php | 4 +- .../Integration/DocumentTest.php | 4 +- .../Integration/Element/ElementArrayTest.php | 4 +- .../Element/ElementBooleanTest.php | 4 +- .../Integration/Element/ElementDateTest.php | 4 +- .../Integration/Element/ElementHexaTest.php | 4 +- .../Element/ElementMissingTest.php | 4 +- .../Integration/Element/ElementNameTest.php | 4 +- .../Integration/Element/ElementNullTest.php | 4 +- .../Element/ElementNumericTest.php | 4 +- .../Integration/Element/ElementStringTest.php | 4 +- .../Integration/Element/ElementStructTest.php | 4 +- .../Integration/Element/ElementXRefTest.php | 4 +- .../{ => PHPUnit}/Integration/ElementTest.php | 4 +- .../Integration/EncodingTest.php | 4 +- tests/{ => PHPUnit}/Integration/FontTest.php | 4 +- .../{ => PHPUnit}/Integration/HeaderTest.php | 4 +- .../Integration/PDFObjectTest.php | 4 +- tests/{ => PHPUnit}/Integration/PageTest.php | 4 +- .../{ => PHPUnit}/Integration/ParserTest.php | 4 +- .../Integration/RawData/FilterHelperTest.php | 4 +- .../Integration/RawData/RawDataParserTest.php | 4 +- tests/{ => PHPUnit}/TestCase.php | 4 +- tests/{ => PHPUnit}/Unit/ConfigTest.php | 4 +- tests/{ => PHPUnit}/Unit/DocumentTest.php | 4 +- tests/{ => PHPUnit}/Unit/EncodingTest.php | 4 +- tests/{ => PHPUnit}/Unit/PDFObjectTest.php | 4 +- ...t.php => AbstractPerformanceTestClass.php} | 4 +- .../Exception/PerformanceFailException.php | 2 +- .../Test/DocumentDictionaryCacheTest.php | 6 +-- tests/Performance/runPerformanceTests.php | 7 ++- 37 files changed, 87 insertions(+), 100 deletions(-) rename tests/{AltAutoloadTest.php => AltAutoloading/AltAutoloadCheck.php} (96%) rename tests/{ => PHPUnit}/Integration/ConfigTest.php (95%) rename tests/{ => PHPUnit}/Integration/DocumentTest.php (99%) rename tests/{ => PHPUnit}/Integration/Element/ElementArrayTest.php (98%) rename tests/{ => PHPUnit}/Integration/Element/ElementBooleanTest.php (98%) rename tests/{ => PHPUnit}/Integration/Element/ElementDateTest.php (98%) rename tests/{ => PHPUnit}/Integration/Element/ElementHexaTest.php (97%) rename tests/{ => PHPUnit}/Integration/Element/ElementMissingTest.php (95%) rename tests/{ => PHPUnit}/Integration/Element/ElementNameTest.php (98%) rename tests/{ => PHPUnit}/Integration/Element/ElementNullTest.php (97%) rename tests/{ => PHPUnit}/Integration/Element/ElementNumericTest.php (98%) rename tests/{ => PHPUnit}/Integration/Element/ElementStringTest.php (98%) rename tests/{ => PHPUnit}/Integration/Element/ElementStructTest.php (97%) rename tests/{ => PHPUnit}/Integration/Element/ElementXRefTest.php (97%) rename tests/{ => PHPUnit}/Integration/ElementTest.php (98%) rename tests/{ => PHPUnit}/Integration/EncodingTest.php (97%) rename tests/{ => PHPUnit}/Integration/FontTest.php (99%) rename tests/{ => PHPUnit}/Integration/HeaderTest.php (98%) rename tests/{ => PHPUnit}/Integration/PDFObjectTest.php (98%) rename tests/{ => PHPUnit}/Integration/PageTest.php (99%) rename tests/{ => PHPUnit}/Integration/ParserTest.php (99%) rename tests/{ => PHPUnit}/Integration/RawData/FilterHelperTest.php (98%) rename tests/{ => PHPUnit}/Integration/RawData/RawDataParserTest.php (98%) rename tests/{ => PHPUnit}/TestCase.php (96%) rename tests/{ => PHPUnit}/Unit/ConfigTest.php (96%) rename tests/{ => PHPUnit}/Unit/DocumentTest.php (78%) rename tests/{ => PHPUnit}/Unit/EncodingTest.php (80%) rename tests/{ => PHPUnit}/Unit/PDFObjectTest.php (87%) rename tests/Performance/{Test/AbstractPerformanceTest.php => AbstractPerformanceTestClass.php} (79%) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 9054a694..7c100977 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -165,7 +165,7 @@ jobs: coverage: "none" - name: "Test alt-autoload" - run: "php tests/AltAutoloadTest.php" + run: "php tests/AltAutoloading/AltAutoloadCheck.php" phpunit-lowest: name: "PHPUnit lowest deps (PHP ${{ matrix.php }})" diff --git a/.gitignore b/.gitignore index 241a7ed2..841b7199 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ debug* composer.lock /.php-cs-fixer.cache +/.phpunit.cache /.phpunit.result.cache diff --git a/composer.json b/composer.json index c91fab8c..e9f425fd 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,8 @@ }, "autoload-dev": { "psr-4": { - "Tests\\Smalot\\PdfParser\\": "tests/" + "PerformanceTests\\": "tests/Performance/", + "PHPUnitTests\\": "tests/PHPUnit/" } }, "config": { diff --git a/phpunit-windows.xml b/phpunit-windows.xml index bddf09d4..c64623c4 100644 --- a/phpunit-windows.xml +++ b/phpunit-windows.xml @@ -25,7 +25,7 @@ - tests + tests/PHPUnit diff --git a/phpunit.xml b/phpunit.xml index c7dadfa5..3feaa53c 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,35 +1,21 @@ - - - - - - - - - - - - - tests - - - - - src - - + + + + src + + + + + + + + + + + + tests/PHPUnit + + diff --git a/tests/AltAutoloadTest.php b/tests/AltAutoloading/AltAutoloadCheck.php similarity index 96% rename from tests/AltAutoloadTest.php rename to tests/AltAutoloading/AltAutoloadCheck.php index ec73b45d..d89c2b67 100644 --- a/tests/AltAutoloadTest.php +++ b/tests/AltAutoloading/AltAutoloadCheck.php @@ -28,7 +28,7 @@ * along with this program. * If not, see . */ -require __DIR__.'/../alt_autoload.php-dist'; +require __DIR__.'/../../alt_autoload.php-dist'; $parser = new Smalot\PdfParser\Parser(); diff --git a/tests/Integration/ConfigTest.php b/tests/PHPUnit/Integration/ConfigTest.php similarity index 95% rename from tests/Integration/ConfigTest.php rename to tests/PHPUnit/Integration/ConfigTest.php index 0f6d1bc8..7b0ecc8e 100644 --- a/tests/Integration/ConfigTest.php +++ b/tests/PHPUnit/Integration/ConfigTest.php @@ -33,10 +33,10 @@ * If not, see . */ -namespace Tests\Smalot\PdfParser\Integration; +namespace PHPUnitTests\Integration; +use PHPUnitTests\TestCase; use Smalot\PdfParser\Config; -use Tests\Smalot\PdfParser\TestCase; class ConfigTest extends TestCase { diff --git a/tests/Integration/DocumentTest.php b/tests/PHPUnit/Integration/DocumentTest.php similarity index 99% rename from tests/Integration/DocumentTest.php rename to tests/PHPUnit/Integration/DocumentTest.php index 7cfeec26..8ab48e30 100644 --- a/tests/Integration/DocumentTest.php +++ b/tests/PHPUnit/Integration/DocumentTest.php @@ -33,15 +33,15 @@ * If not, see . */ -namespace Tests\Smalot\PdfParser\Integration; +namespace PHPUnitTests\Integration; +use PHPUnitTests\TestCase; use Smalot\PdfParser\Document; use Smalot\PdfParser\Header; use Smalot\PdfParser\Page; use Smalot\PdfParser\Pages; use Smalot\PdfParser\Parser; use Smalot\PdfParser\PDFObject; -use Tests\Smalot\PdfParser\TestCase; class DocumentTest extends TestCase { diff --git a/tests/Integration/Element/ElementArrayTest.php b/tests/PHPUnit/Integration/Element/ElementArrayTest.php similarity index 98% rename from tests/Integration/Element/ElementArrayTest.php rename to tests/PHPUnit/Integration/Element/ElementArrayTest.php index 33145242..0b095a41 100644 --- a/tests/Integration/Element/ElementArrayTest.php +++ b/tests/PHPUnit/Integration/Element/ElementArrayTest.php @@ -33,14 +33,14 @@ * If not, see . */ -namespace Tests\Smalot\PdfParser\Integration\Element; +namespace PHPUnitTests\Integration\Element; +use PHPUnitTests\TestCase; use Smalot\PdfParser\Document; use Smalot\PdfParser\Element\ElementArray; use Smalot\PdfParser\Element\ElementNumeric; use Smalot\PdfParser\Header; use Smalot\PdfParser\Page; -use Tests\Smalot\PdfParser\TestCase; class ElementArrayTest extends TestCase { diff --git a/tests/Integration/Element/ElementBooleanTest.php b/tests/PHPUnit/Integration/Element/ElementBooleanTest.php similarity index 98% rename from tests/Integration/Element/ElementBooleanTest.php rename to tests/PHPUnit/Integration/Element/ElementBooleanTest.php index 3598b639..84d83cd8 100644 --- a/tests/Integration/Element/ElementBooleanTest.php +++ b/tests/PHPUnit/Integration/Element/ElementBooleanTest.php @@ -33,10 +33,10 @@ * If not, see . */ -namespace Tests\Smalot\PdfParser\Integration\Element; +namespace PHPUnitTests\Integration\Element; +use PHPUnitTests\TestCase; use Smalot\PdfParser\Element\ElementBoolean; -use Tests\Smalot\PdfParser\TestCase; class ElementBooleanTest extends TestCase { diff --git a/tests/Integration/Element/ElementDateTest.php b/tests/PHPUnit/Integration/Element/ElementDateTest.php similarity index 98% rename from tests/Integration/Element/ElementDateTest.php rename to tests/PHPUnit/Integration/Element/ElementDateTest.php index fd03c34b..3f0d5e4e 100644 --- a/tests/Integration/Element/ElementDateTest.php +++ b/tests/PHPUnit/Integration/Element/ElementDateTest.php @@ -33,10 +33,10 @@ * If not, see . */ -namespace Tests\Smalot\PdfParser\Integration\Element; +namespace PHPUnitTests\Integration\Element; +use PHPUnitTests\TestCase; use Smalot\PdfParser\Element\ElementDate; -use Tests\Smalot\PdfParser\TestCase; class ElementDateTest extends TestCase { diff --git a/tests/Integration/Element/ElementHexaTest.php b/tests/PHPUnit/Integration/Element/ElementHexaTest.php similarity index 97% rename from tests/Integration/Element/ElementHexaTest.php rename to tests/PHPUnit/Integration/Element/ElementHexaTest.php index 1f84ae96..fe990eba 100644 --- a/tests/Integration/Element/ElementHexaTest.php +++ b/tests/PHPUnit/Integration/Element/ElementHexaTest.php @@ -33,12 +33,12 @@ * If not, see . */ -namespace Tests\Smalot\PdfParser\Integration\Element; +namespace PHPUnitTests\Integration\Element; +use PHPUnitTests\TestCase; use Smalot\PdfParser\Element\ElementDate; use Smalot\PdfParser\Element\ElementHexa; use Smalot\PdfParser\Element\ElementString; -use Tests\Smalot\PdfParser\TestCase; class ElementHexaTest extends TestCase { diff --git a/tests/Integration/Element/ElementMissingTest.php b/tests/PHPUnit/Integration/Element/ElementMissingTest.php similarity index 95% rename from tests/Integration/Element/ElementMissingTest.php rename to tests/PHPUnit/Integration/Element/ElementMissingTest.php index 9b8cfabf..0930cf5a 100644 --- a/tests/Integration/Element/ElementMissingTest.php +++ b/tests/PHPUnit/Integration/Element/ElementMissingTest.php @@ -33,10 +33,10 @@ * If not, see . */ -namespace Tests\Smalot\PdfParser\Integration\Element; +namespace PHPUnitTests\Integration\Element; +use PHPUnitTests\TestCase; use Smalot\PdfParser\Element\ElementMissing; -use Tests\Smalot\PdfParser\TestCase; class ElementMissingTest extends TestCase { diff --git a/tests/Integration/Element/ElementNameTest.php b/tests/PHPUnit/Integration/Element/ElementNameTest.php similarity index 98% rename from tests/Integration/Element/ElementNameTest.php rename to tests/PHPUnit/Integration/Element/ElementNameTest.php index 7d8b6a3d..0f390836 100644 --- a/tests/Integration/Element/ElementNameTest.php +++ b/tests/PHPUnit/Integration/Element/ElementNameTest.php @@ -33,10 +33,10 @@ * If not, see . */ -namespace Tests\Smalot\PdfParser\Integration\Element; +namespace PHPUnitTests\Integration\Element; +use PHPUnitTests\TestCase; use Smalot\PdfParser\Element\ElementName; -use Tests\Smalot\PdfParser\TestCase; class ElementNameTest extends TestCase { diff --git a/tests/Integration/Element/ElementNullTest.php b/tests/PHPUnit/Integration/Element/ElementNullTest.php similarity index 97% rename from tests/Integration/Element/ElementNullTest.php rename to tests/PHPUnit/Integration/Element/ElementNullTest.php index f07060f1..4a70a81c 100644 --- a/tests/Integration/Element/ElementNullTest.php +++ b/tests/PHPUnit/Integration/Element/ElementNullTest.php @@ -33,10 +33,10 @@ * If not, see . */ -namespace Tests\Smalot\PdfParser\Integration\Element; +namespace PHPUnitTests\Integration\Element; +use PHPUnitTests\TestCase; use Smalot\PdfParser\Element\ElementNull; -use Tests\Smalot\PdfParser\TestCase; class ElementNullTest extends TestCase { diff --git a/tests/Integration/Element/ElementNumericTest.php b/tests/PHPUnit/Integration/Element/ElementNumericTest.php similarity index 98% rename from tests/Integration/Element/ElementNumericTest.php rename to tests/PHPUnit/Integration/Element/ElementNumericTest.php index fec45ca4..c9b4e7ab 100644 --- a/tests/Integration/Element/ElementNumericTest.php +++ b/tests/PHPUnit/Integration/Element/ElementNumericTest.php @@ -33,10 +33,10 @@ * If not, see . */ -namespace Tests\Smalot\PdfParser\Integration\Element; +namespace PHPUnitTests\Integration\Element; +use PHPUnitTests\TestCase; use Smalot\PdfParser\Element\ElementNumeric; -use Tests\Smalot\PdfParser\TestCase; class ElementNumericTest extends TestCase { diff --git a/tests/Integration/Element/ElementStringTest.php b/tests/PHPUnit/Integration/Element/ElementStringTest.php similarity index 98% rename from tests/Integration/Element/ElementStringTest.php rename to tests/PHPUnit/Integration/Element/ElementStringTest.php index 36d83eae..61d3ad6b 100644 --- a/tests/Integration/Element/ElementStringTest.php +++ b/tests/PHPUnit/Integration/Element/ElementStringTest.php @@ -33,10 +33,10 @@ * If not, see . */ -namespace Tests\Smalot\PdfParser\Integration\Element; +namespace PHPUnitTests\Integration\Element; +use PHPUnitTests\TestCase; use Smalot\PdfParser\Element\ElementString; -use Tests\Smalot\PdfParser\TestCase; class ElementStringTest extends TestCase { diff --git a/tests/Integration/Element/ElementStructTest.php b/tests/PHPUnit/Integration/Element/ElementStructTest.php similarity index 97% rename from tests/Integration/Element/ElementStructTest.php rename to tests/PHPUnit/Integration/Element/ElementStructTest.php index a3b4a0f9..aa5c994b 100644 --- a/tests/Integration/Element/ElementStructTest.php +++ b/tests/PHPUnit/Integration/Element/ElementStructTest.php @@ -33,11 +33,11 @@ * If not, see . */ -namespace Tests\Smalot\PdfParser\Integration\Element; +namespace PHPUnitTests\Integration\Element; +use PHPUnitTests\TestCase; use Smalot\PdfParser\Element\ElementStruct; use Smalot\PdfParser\Header; -use Tests\Smalot\PdfParser\TestCase; class ElementStructTest extends TestCase { diff --git a/tests/Integration/Element/ElementXRefTest.php b/tests/PHPUnit/Integration/Element/ElementXRefTest.php similarity index 97% rename from tests/Integration/Element/ElementXRefTest.php rename to tests/PHPUnit/Integration/Element/ElementXRefTest.php index 978c901c..b420ad9d 100644 --- a/tests/Integration/Element/ElementXRefTest.php +++ b/tests/PHPUnit/Integration/Element/ElementXRefTest.php @@ -33,10 +33,10 @@ * If not, see . */ -namespace Tests\Smalot\PdfParser\Integration\Element; +namespace PHPUnitTests\Integration\Element; +use PHPUnitTests\TestCase; use Smalot\PdfParser\Element\ElementXRef; -use Tests\Smalot\PdfParser\TestCase; class ElementXRefTest extends TestCase { diff --git a/tests/Integration/ElementTest.php b/tests/PHPUnit/Integration/ElementTest.php similarity index 98% rename from tests/Integration/ElementTest.php rename to tests/PHPUnit/Integration/ElementTest.php index 72aa8e49..2b40b7e7 100644 --- a/tests/Integration/ElementTest.php +++ b/tests/PHPUnit/Integration/ElementTest.php @@ -33,8 +33,9 @@ * If not, see . */ -namespace Tests\Smalot\PdfParser\Integration; +namespace PHPUnitTests\Integration; +use PHPUnitTests\TestCase; use Smalot\PdfParser\Element; use Smalot\PdfParser\Element\ElementArray; use Smalot\PdfParser\Element\ElementBoolean; @@ -45,7 +46,6 @@ use Smalot\PdfParser\Element\ElementString; use Smalot\PdfParser\Element\ElementXRef; use Smalot\PdfParser\Header; -use Tests\Smalot\PdfParser\TestCase; class ElementTest extends TestCase { diff --git a/tests/Integration/EncodingTest.php b/tests/PHPUnit/Integration/EncodingTest.php similarity index 97% rename from tests/Integration/EncodingTest.php rename to tests/PHPUnit/Integration/EncodingTest.php index 8a61def8..07411790 100644 --- a/tests/Integration/EncodingTest.php +++ b/tests/PHPUnit/Integration/EncodingTest.php @@ -33,16 +33,16 @@ * If not, see . */ -namespace Tests\Smalot\PdfParser\Integration; +namespace PHPUnitTests\Integration; use Exception; +use PHPUnitTests\TestCase; use Smalot\PdfParser\Document; use Smalot\PdfParser\Element; use Smalot\PdfParser\Encoding; use Smalot\PdfParser\Encoding\StandardEncoding; use Smalot\PdfParser\Exception\EncodingNotFoundException; use Smalot\PdfParser\Header; -use Tests\Smalot\PdfParser\TestCase; class EncodingTest extends TestCase { diff --git a/tests/Integration/FontTest.php b/tests/PHPUnit/Integration/FontTest.php similarity index 99% rename from tests/Integration/FontTest.php rename to tests/PHPUnit/Integration/FontTest.php index 4dcfd9ae..cc5a3f86 100644 --- a/tests/Integration/FontTest.php +++ b/tests/PHPUnit/Integration/FontTest.php @@ -33,8 +33,9 @@ * If not, see . */ -namespace Tests\Smalot\PdfParser\Integration; +namespace PHPUnitTests\Integration; +use PHPUnitTests\TestCase; use Smalot\PdfParser\Config; use Smalot\PdfParser\Document; use Smalot\PdfParser\Element; @@ -42,7 +43,6 @@ use Smalot\PdfParser\Font; use Smalot\PdfParser\Header; use Smalot\PdfParser\PDFObject; -use Tests\Smalot\PdfParser\TestCase; class FontTest extends TestCase { diff --git a/tests/Integration/HeaderTest.php b/tests/PHPUnit/Integration/HeaderTest.php similarity index 98% rename from tests/Integration/HeaderTest.php rename to tests/PHPUnit/Integration/HeaderTest.php index 0fb3fc33..c18e7a35 100644 --- a/tests/Integration/HeaderTest.php +++ b/tests/PHPUnit/Integration/HeaderTest.php @@ -33,15 +33,15 @@ * If not, see . */ -namespace Tests\Smalot\PdfParser\Integration; +namespace PHPUnitTests\Integration; +use PHPUnitTests\TestCase; use Smalot\PdfParser\Element; use Smalot\PdfParser\Element\ElementMissing; use Smalot\PdfParser\Element\ElementName; use Smalot\PdfParser\Header; use Smalot\PdfParser\Page; use Smalot\PdfParser\PDFObject; -use Tests\Smalot\PdfParser\TestCase; /** * Class Header diff --git a/tests/Integration/PDFObjectTest.php b/tests/PHPUnit/Integration/PDFObjectTest.php similarity index 98% rename from tests/Integration/PDFObjectTest.php rename to tests/PHPUnit/Integration/PDFObjectTest.php index 2bb75284..97741675 100644 --- a/tests/Integration/PDFObjectTest.php +++ b/tests/PHPUnit/Integration/PDFObjectTest.php @@ -33,11 +33,11 @@ * If not, see . */ -namespace Tests\Smalot\PdfParser\Integration; +namespace PHPUnitTests\Integration; +use PHPUnitTests\TestCase; use Smalot\PdfParser\Document; use Smalot\PdfParser\PDFObject; -use Tests\Smalot\PdfParser\TestCase; class PDFObjectTest extends TestCase { diff --git a/tests/Integration/PageTest.php b/tests/PHPUnit/Integration/PageTest.php similarity index 99% rename from tests/Integration/PageTest.php rename to tests/PHPUnit/Integration/PageTest.php index f5619c42..e94723d4 100644 --- a/tests/Integration/PageTest.php +++ b/tests/PHPUnit/Integration/PageTest.php @@ -33,14 +33,14 @@ * If not, see . */ -namespace Tests\Smalot\PdfParser\Integration; +namespace PHPUnitTests\Integration; +use PHPUnitTests\TestCase; use Smalot\PdfParser\Config; use Smalot\PdfParser\Document; use Smalot\PdfParser\Element\ElementMissing; use Smalot\PdfParser\Font; use Smalot\PdfParser\Page; -use Tests\Smalot\PdfParser\TestCase; class PageTest extends TestCase { diff --git a/tests/Integration/ParserTest.php b/tests/PHPUnit/Integration/ParserTest.php similarity index 99% rename from tests/Integration/ParserTest.php rename to tests/PHPUnit/Integration/ParserTest.php index cca3aa3b..45a97f52 100644 --- a/tests/Integration/ParserTest.php +++ b/tests/PHPUnit/Integration/ParserTest.php @@ -33,13 +33,13 @@ * If not, see . */ -namespace Tests\Smalot\PdfParser\Integration; +namespace PHPUnitTests\Integration; +use PHPUnitTests\TestCase; use Smalot\PdfParser\Config; use Smalot\PdfParser\Document; use Smalot\PdfParser\Parser; use Smalot\PdfParser\XObject\Image; -use Tests\Smalot\PdfParser\TestCase; class ParserTest extends TestCase { diff --git a/tests/Integration/RawData/FilterHelperTest.php b/tests/PHPUnit/Integration/RawData/FilterHelperTest.php similarity index 98% rename from tests/Integration/RawData/FilterHelperTest.php rename to tests/PHPUnit/Integration/RawData/FilterHelperTest.php index caa5eeae..81c71309 100644 --- a/tests/Integration/RawData/FilterHelperTest.php +++ b/tests/PHPUnit/Integration/RawData/FilterHelperTest.php @@ -33,10 +33,10 @@ * If not, see . */ -namespace Tests\Smalot\PdfParser\Integration\RawData; +namespace PHPUnitTests\Integration\RawData; +use PHPUnitTests\TestCase; use Smalot\PdfParser\RawData\FilterHelper; -use Tests\Smalot\PdfParser\TestCase; class FilterHelperTest extends TestCase { diff --git a/tests/Integration/RawData/RawDataParserTest.php b/tests/PHPUnit/Integration/RawData/RawDataParserTest.php similarity index 98% rename from tests/Integration/RawData/RawDataParserTest.php rename to tests/PHPUnit/Integration/RawData/RawDataParserTest.php index c3987dfe..17c64d30 100644 --- a/tests/Integration/RawData/RawDataParserTest.php +++ b/tests/PHPUnit/Integration/RawData/RawDataParserTest.php @@ -33,11 +33,11 @@ * If not, see . */ -namespace Tests\Smalot\PdfParser\Integration\RawData; +namespace PHPUnitTests\Integration\RawData; +use PHPUnitTests\TestCase; use Smalot\PdfParser\Config; use Smalot\PdfParser\RawData\RawDataParser; -use Tests\Smalot\PdfParser\TestCase; class RawDataParserHelper extends RawDataParser { diff --git a/tests/TestCase.php b/tests/PHPUnit/TestCase.php similarity index 96% rename from tests/TestCase.php rename to tests/PHPUnit/TestCase.php index 34d0fab5..08d4739a 100644 --- a/tests/TestCase.php +++ b/tests/PHPUnit/TestCase.php @@ -33,7 +33,7 @@ * If not, see . */ -namespace Tests\Smalot\PdfParser; +namespace PHPUnitTests; use PHPUnit\Framework\TestCase as PHPTestCase; use Smalot\PdfParser\Config; @@ -54,7 +54,7 @@ protected function setUp(): void { parent::setUp(); - $this->rootDir = __DIR__.'/..'; + $this->rootDir = __DIR__.'/../..'; } protected function getDocumentInstance(): Document diff --git a/tests/Unit/ConfigTest.php b/tests/PHPUnit/Unit/ConfigTest.php similarity index 96% rename from tests/Unit/ConfigTest.php rename to tests/PHPUnit/Unit/ConfigTest.php index 8cbbf321..133c7eb1 100644 --- a/tests/Unit/ConfigTest.php +++ b/tests/PHPUnit/Unit/ConfigTest.php @@ -29,10 +29,10 @@ * If not, see . */ -namespace Tests\Smalot\PdfParser\Unit; +namespace PHPUnitTests\Unit; +use PHPUnitTests\TestCase; use Smalot\PdfParser\Config; -use Tests\Smalot\PdfParser\TestCase; class ConfigTest extends TestCase { diff --git a/tests/Unit/DocumentTest.php b/tests/PHPUnit/Unit/DocumentTest.php similarity index 78% rename from tests/Unit/DocumentTest.php rename to tests/PHPUnit/Unit/DocumentTest.php index 80f7a8a3..e28ee9c7 100644 --- a/tests/Unit/DocumentTest.php +++ b/tests/PHPUnit/Unit/DocumentTest.php @@ -2,10 +2,10 @@ declare(strict_types=1); -namespace Tests\Smalot\PdfParser\Unit; +namespace PHPUnitTests\Unit; +use PHPUnitTests\TestCase; use Smalot\PdfParser\Document; -use Tests\Smalot\PdfParser\TestCase; class DocumentTest extends TestCase { diff --git a/tests/Unit/EncodingTest.php b/tests/PHPUnit/Unit/EncodingTest.php similarity index 80% rename from tests/Unit/EncodingTest.php rename to tests/PHPUnit/Unit/EncodingTest.php index 36566a2a..7116b5dc 100644 --- a/tests/Unit/EncodingTest.php +++ b/tests/PHPUnit/Unit/EncodingTest.php @@ -2,11 +2,11 @@ declare(strict_types=1); -namespace Tests\Smalot\PdfParser\Unit; +namespace PHPUnitTests\Unit; +use PHPUnitTests\TestCase; use Smalot\PdfParser\Document; use Smalot\PdfParser\Encoding; -use Tests\Smalot\PdfParser\TestCase; class EncodingTest extends TestCase { diff --git a/tests/Unit/PDFObjectTest.php b/tests/PHPUnit/Unit/PDFObjectTest.php similarity index 87% rename from tests/Unit/PDFObjectTest.php rename to tests/PHPUnit/Unit/PDFObjectTest.php index 593f3ec9..9d1abdde 100644 --- a/tests/Unit/PDFObjectTest.php +++ b/tests/PHPUnit/Unit/PDFObjectTest.php @@ -2,12 +2,12 @@ declare(strict_types=1); -namespace Tests\Smalot\PdfParser\Unit; +namespace PHPUnitTests\Unit; +use PHPUnitTests\TestCase; use Smalot\PdfParser\Document; use Smalot\PdfParser\Page; use Smalot\PdfParser\PDFObject; -use Tests\Smalot\PdfParser\TestCase; class PDFObjectTest extends TestCase { diff --git a/tests/Performance/Test/AbstractPerformanceTest.php b/tests/Performance/AbstractPerformanceTestClass.php similarity index 79% rename from tests/Performance/Test/AbstractPerformanceTest.php rename to tests/Performance/AbstractPerformanceTestClass.php index 51a3907e..a7b04d7f 100644 --- a/tests/Performance/Test/AbstractPerformanceTest.php +++ b/tests/Performance/AbstractPerformanceTestClass.php @@ -1,8 +1,8 @@ . */ -namespace Tests\Smalot\PdfParser\Performance\Test; +namespace PerformanceTests\Test; -use Smalot\PdfParser\Page; +use PerformanceTests\AbstractPerformanceTestClass; use Smalot\PdfParser\Parser; /** @@ -44,7 +44,7 @@ * to cache the objects inside the PDF file, then the parsing should be quick. * If it does not, the parsing can be extensively slow or even crash. */ -class DocumentDictionaryCacheTest extends AbstractPerformanceTest +class DocumentDictionaryCacheTest extends AbstractPerformanceTestClass { /** * @var Parser diff --git a/tests/Performance/runPerformanceTests.php b/tests/Performance/runPerformanceTests.php index e91b5193..7f34b60a 100644 --- a/tests/Performance/runPerformanceTests.php +++ b/tests/Performance/runPerformanceTests.php @@ -2,15 +2,14 @@ require __DIR__.'/../../vendor/autoload.php'; -use Tests\Smalot\PdfParser\Performance\Exception\PerformanceFailException; -use Tests\Smalot\PdfParser\Performance\Test\AbstractPerformanceTest; -use Tests\Smalot\PdfParser\Performance\Test\DocumentDictionaryCacheTest; +use PerformanceTests\Exception\PerformanceFailException; +use PerformanceTests\Test\DocumentDictionaryCacheTest; $tests = [ new DocumentDictionaryCacheTest(), ]; -foreach ($tests as $test) { /* @var $test AbstractPerformanceTest */ +foreach ($tests as $test) { $test->init(); $startTime = microtime(true);