Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes failing tests; reorganized test files (PHPUnit 10.x related) #583

Merged
merged 6 commits into from
Mar 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }})"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
debug*
composer.lock
/.php-cs-fixer.cache
/.phpunit.cache
/.phpunit.result.cache
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
},
"autoload-dev": {
"psr-4": {
"Tests\\Smalot\\PdfParser\\": "tests/"
"PerformanceTests\\": "tests/Performance/",
"PHPUnitTests\\": "tests/PHPUnit/"
}
},
"config": {
Expand Down
2 changes: 1 addition & 1 deletion dev-tools/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"friendsofphp/php-cs-fixer": "^3",
"phpstan/phpstan": "^1",
"phpstan/phpstan-phpunit": "^1",
"phpunit/phpunit": ">=7.5"
"phpunit/phpunit": ">=7.5 <11.0"
}
}
51 changes: 18 additions & 33 deletions phpunit-windows.xml
Original file line number Diff line number Diff line change
@@ -1,36 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Only use this when running in Windows environment! -->

<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.1/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor\autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
verbose="true"
>
<php>
<ini name="error_reporting" value="-1" />
<ini name="zend.enable_gc" value="0"/>
<ini name="error_reporting" value="-1"/>
<ini name="intl.error_level" value="0"/>
<ini name="display_errors" value="On"/>
</php>

<testsuites>
<testsuite name="all">
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>src</directory>
</whitelist>
</filter>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd" backupGlobals="false" bootstrap="vendor\autoload.php" colors="true" processIsolation="false" stopOnFailure="false" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<coverage>
<include>
<directory>src</directory>
</include>
</coverage>
<php>
<ini name="error_reporting" value="-1"/>
<ini name="zend.enable_gc" value="0"/>
<ini name="error_reporting" value="-1"/>
<ini name="intl.error_level" value="0"/>
<ini name="display_errors" value="On"/>
</php>
<testsuites>
<testsuite name="all">
<directory>tests/PHPUnit</directory>
</testsuite>
</testsuites>
</phpunit>
50 changes: 18 additions & 32 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,35 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- https://phpunit.de/manual/current/en/appendixes.configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.1/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
verbose="true"
>
<php>
<ini name="error_reporting" value="-1" />
<ini name="zend.enable_gc" value="0"/>
<ini name="error_reporting" value="-1"/>
<ini name="intl.error_level" value="0"/>
<ini name="display_errors" value="On"/>
</php>

<testsuites>
<testsuite name="all">
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>src</directory>
</whitelist>
</filter>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<coverage>
<include>
<directory>src</directory>
</include>
</coverage>
<php>
<ini name="error_reporting" value="-1"/>
<ini name="zend.enable_gc" value="0"/>
<ini name="error_reporting" value="-1"/>
<ini name="intl.error_level" value="0"/>
<ini name="display_errors" value="On"/>
</php>
<testsuites>
<testsuite name="all">
<directory>tests/PHPUnit</directory>
</testsuite>
</testsuites>
</phpunit>
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
* along with this program.
* If not, see <http://www.pdfparser.org/sites/default/LICENSE.txt>.
*/
require __DIR__.'/../alt_autoload.php-dist';
require __DIR__.'/../../alt_autoload.php-dist';

$parser = new Smalot\PdfParser\Parser();

$filename = __DIR__.'/../samples/InternationalChars.pdf';
$filename = __DIR__.'/../../samples/InternationalChars.pdf';
$document = $parser->parseFile($filename);

$needle = 'Лорем ипсум долор сит амет, еу сед либрис долорем инцоррупте.';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
* If not, see <http://www.pdfparser.org/sites/default/LICENSE.txt>.
*/

namespace Tests\Smalot\PdfParser\Integration;
namespace PHPUnitTests\Integration;

use PHPUnitTests\TestCase;
use Smalot\PdfParser\Config;
use Tests\Smalot\PdfParser\TestCase;

class ConfigTest extends TestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@
* If not, see <http://www.pdfparser.org/sites/default/LICENSE.txt>.
*/

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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@
* If not, see <http://www.pdfparser.org/sites/default/LICENSE.txt>.
*/

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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
* If not, see <http://www.pdfparser.org/sites/default/LICENSE.txt>.
*/

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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
* If not, see <http://www.pdfparser.org/sites/default/LICENSE.txt>.
*/

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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
* If not, see <http://www.pdfparser.org/sites/default/LICENSE.txt>.
*/

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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
* If not, see <http://www.pdfparser.org/sites/default/LICENSE.txt>.
*/

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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
* If not, see <http://www.pdfparser.org/sites/default/LICENSE.txt>.
*/

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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
* If not, see <http://www.pdfparser.org/sites/default/LICENSE.txt>.
*/

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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
* If not, see <http://www.pdfparser.org/sites/default/LICENSE.txt>.
*/

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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
* If not, see <http://www.pdfparser.org/sites/default/LICENSE.txt>.
*/

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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
* If not, see <http://www.pdfparser.org/sites/default/LICENSE.txt>.
*/

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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
* If not, see <http://www.pdfparser.org/sites/default/LICENSE.txt>.
*/

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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@
* If not, see <http://www.pdfparser.org/sites/default/LICENSE.txt>.
*/

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;
Expand All @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@
* If not, see <http://www.pdfparser.org/sites/default/LICENSE.txt>.
*/

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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@
* If not, see <http://www.pdfparser.org/sites/default/LICENSE.txt>.
*/

namespace Tests\Smalot\PdfParser\Integration;
namespace PHPUnitTests\Integration;

use PHPUnitTests\TestCase;
use Smalot\PdfParser\Config;
use Smalot\PdfParser\Document;
use Smalot\PdfParser\Element;
use Smalot\PdfParser\Encoding;
use Smalot\PdfParser\Font;
use Smalot\PdfParser\Header;
use Smalot\PdfParser\PDFObject;
use Tests\Smalot\PdfParser\TestCase;

class FontTest extends TestCase
{
Expand Down
Loading