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

Conversation

k00ni
Copy link
Collaborator

@k00ni k00ni commented Mar 9, 2023

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. PHPUnit v10 doesn't like abstract Test classes or files (containing Test in the name), which contain no class at all. Source: sebastianbergmann/phpunit#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.

#581 and #582 will be processed after this one is merged.

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: sebastianbergmann/phpunit#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.
@k00ni k00ni self-assigned this Mar 9, 2023
@k00ni k00ni marked this pull request as ready for review March 9, 2023 09:31
@k00ni
Copy link
Collaborator Author

k00ni commented Mar 9, 2023

CC @j0k3r @smalot

Copy link
Collaborator

@j0k3r j0k3r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should lock the PHPUnit version, see https://thephp.cc/articles/the-death-star-version-constraint

@k00ni
Copy link
Collaborator Author

k00ni commented Mar 9, 2023

Maybe we should lock the PHPUnit version, see https://thephp.cc/articles/the-death-star-version-constraint

I would advise against that, because it only delays required changes. I prefer seeing problems as soon as possible. Maybe there is some compromise here?

@j0k3r
Copy link
Collaborator

j0k3r commented Mar 9, 2023

Well, it's a way to do it.
Keeping unlocked version means when PHPUnit 11 will be released someone will have to quickly fix issues (if any) otherwise all PRs will fail.
Keeping a locked version avoid that problem. And then, we can smoothly update PHPUnit later without hurry

@k00ni
Copy link
Collaborator Author

k00ni commented Mar 9, 2023

Good points, I implemented a lock.

What do you think about the rest?

Copy link
Collaborator

@j0k3r j0k3r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rest looks ok 👍🏼

dev-tools/composer.json Outdated Show resolved Hide resolved
Co-authored-by: Jérémy Benoist <j0k3r@users.noreply.github.com>
@k00ni k00ni merged commit 3ef8bc5 into master Mar 10, 2023
@k00ni k00ni deleted the fix/failing-tests branch March 10, 2023 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants