Skip to content

Restore Phpunit Tests #18

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

Closed
wants to merge 1 commit into from
Closed

Restore Phpunit Tests #18

wants to merge 1 commit into from

Conversation

ktomk
Copy link
Contributor

@ktomk ktomk commented Feb 12, 2025

Since Travis is gone we've missed the opportunity to run the Phpunit test-cases.

This pull request restores the test-suite in the current matrix on Microsoft Github.

To test locally, run composer install and then composer test.

The `pear run-tests -r tests/` command executes the .phpt tests of which
there are none for Net/URL2:

    pear run-tests -r tests/
    Running 0 tests
    TOTAL TIME: 00:00
    0 PASSED TESTS
    0 SKIPPED TESTS

Running with `-u` for the Phpunit test-cases fails with the pear test
runner as long as it is not possible to install Phpunit via pear.

As an intermediate, use the phpunit test runner from the project
configuration (composer.json) and bootstrap across PHP versions.

Additionally, touch the test-cases for updates of PhpUnit since versions
3/4/5 up to 12.0.2 (tested with PHP 5.3-8.4).
@reedy
Copy link
Contributor

reedy commented Mar 9, 2025

Followup to #15

@@ -46,5 +46,8 @@
},
"require-dev": {
"phpunit/phpunit": ">=3.3.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm always slightly suspicious of these things apparently working with such old versions... Considering how much these packages like to change things

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They are, only the output of the test-runner changes a bit:

  • PHPUnit 4.8.36 OK (113 tests, 270 assertions)
  • PHPUnit 12.0.2 OK, but there were issues! / Tests: 113, Assertions: 270, PHPUnit Deprecations: 1.

See here: https://github.com/ktomk/Net_URL2/actions/runs/13295699011

@@ -762,6 +767,8 @@ public function test19315()
Net_URL2::removeDotSegments($nonStringObject);
} catch (PHPUnit_Framework_Error $error) {
$this->addToAssertionCount(1);
} catch (Throwable $error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Throwable is only in PHP7/PHP 8... So this presuambly isn't going to work on some of the old old versions of PHP we're still in theory trying to test on (PHP 5.3)?

https://www.php.net/manual/en/class.throwable.php

I did query which version of PHP we should be supporting (and such, testing) in https://pear.php.net/bugs/bug.php?id=28662

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's not a problem, it's forwards compatible. The tests show that as well and cover PHP 5.3...8.4.

@ktomk ktomk closed this Mar 11, 2025
@ktomk ktomk deleted the phpunit branch March 11, 2025 22:41
@reedy
Copy link
Contributor

reedy commented Mar 12, 2025

Why delete the PR?

@ktomk
Copy link
Contributor Author

ktomk commented Mar 12, 2025

@reedy I'm sorry for the confusion this causes. I've decided to do a full release and have started to consolidate for that and it looks this branch went bonkers while cleaning up.

ktomk added a commit to ktomk/Net_URL2 that referenced this pull request Mar 12, 2025
Resolves: https://pear.php.net/bugs/bug.php?id=29032 "Request #29032: Release with PHP 8.4 support (Sam Reed, 2025-03-07)"
Resolves: pear#20 "MSGH Pear Net_URL2 pear#20: URL2.php remove executable bit (Sam Reed, 2025-02-28)"
Resolves: pear#18 "MSGH Pear Net_URL2 pear#18: Restore Phpunit Tests (Tom Klingenberg, 2025-02-12)"
Resolves: pear#17 "MSGH Pear Net_URL2 pear#17: Fix _encodeData regexp (Andreas Kurth, 2025-02-09)"
Resolves: https://pear.php.net/bugs/bug.php?id=28662 "Request #28662: Minimum supported PHP version? (Sam Reed, 2024-11-25)"
Resolves: pear#15 "MSGH Pear Net_URL2 pear#15: Update CI to GitHub Actions (Sam Reed, 2024-11-25)"
Resolves: pear#14 "MSGH Pear Net_URL2 pear#14: URL2: Fix implicit null declaration (Sam Reed, 2024-11-25)"
Resolves: https://pear.php.net/bugs/bug.php?id=28649 "Bug #28649: PHP 8.4 compatybility bug" (Aleksander Machniak, 2024-08-30)
Resolves: pear#13 "MSGH Pear Net_URL2 pear#13: Add .gitattributes to exclude dev files from Composer package (Timo Tijhof, 2020-02-15)"
ktomk added a commit to ktomk/Net_URL2 that referenced this pull request Mar 12, 2025
Resolves: https://pear.php.net/bugs/bug.php?id=29032 "Request #29032: Release with PHP 8.4 support (Sam Reed, 2025-03-07)"
Resolves: pear#20 "MSGH Pear Net_URL2 pear#20: URL2.php remove executable bit (Sam Reed, 2025-02-28)"
Resolves: pear#18 "MSGH Pear Net_URL2 pear#18: Restore Phpunit Tests (Tom Klingenberg, 2025-02-12)"
Resolves: pear#17 "MSGH Pear Net_URL2 pear#17: Fix _encodeData regexp (Andreas Kurth, 2025-02-09)"
Resolves: https://pear.php.net/bugs/bug.php?id=28662 "Request #28662: Minimum supported PHP version? (Sam Reed, 2024-11-25)"
Resolves: pear#15 "MSGH Pear Net_URL2 pear#15: Update CI to GitHub Actions (Sam Reed, 2024-11-25)"
Resolves: pear#14 "MSGH Pear Net_URL2 pear#14: URL2: Fix implicit null declaration (Sam Reed, 2024-11-25)"
Resolves: https://pear.php.net/bugs/bug.php?id=28649 "Bug #28649: PHP 8.4 compatybility bug" (Aleksander Machniak, 2024-08-30)
Resolves: pear#13 "MSGH Pear Net_URL2 pear#13: Add .gitattributes to exclude dev files from Composer package (Timo Tijhof, 2020-02-15)"
@reedy
Copy link
Contributor

reedy commented Mar 12, 2025

Aha cool!

I was a bit confused, as it was like... surely this is a good thing to have!?

ktomk added a commit to ktomk/Net_URL2 that referenced this pull request Mar 24, 2025
Resolves: https://pear.php.net/bugs/bug.php?id=29032 "Request #29032: Release with PHP 8.4 support (Sam Reed, 2025-03-07)"
Resolves: pear#20 "MSGH Pear Net_URL2 pear#20: URL2.php remove executable bit (Sam Reed, 2025-02-28)"
Resolves: pear#18 "MSGH Pear Net_URL2 pear#18: Restore Phpunit Tests (Tom Klingenberg, 2025-02-12)"
Resolves: pear#17 "MSGH Pear Net_URL2 pear#17: Fix _encodeData regexp (Andreas Kurth, 2025-02-09)"
Resolves: https://pear.php.net/bugs/bug.php?id=28662 "Request #28662: Minimum supported PHP version? (Sam Reed, 2024-11-25)"
Resolves: pear#15 "MSGH Pear Net_URL2 pear#15: Update CI to GitHub Actions (Sam Reed, 2024-11-25)"
Resolves: pear#14 "MSGH Pear Net_URL2 pear#14: URL2: Fix implicit null declaration (Sam Reed, 2024-11-25)"
Resolves: https://pear.php.net/bugs/bug.php?id=28649 "Bug #28649: PHP 8.4 compatybility bug" (Aleksander Machniak, 2024-08-30)
Resolves: pear#13 "MSGH Pear Net_URL2 pear#13: Add .gitattributes to exclude dev files from Composer package (Timo Tijhof, 2020-02-15)"
ktomk added a commit to ktomk/Net_URL2 that referenced this pull request Mar 24, 2025
Resolves: https://pear.php.net/bugs/bug.php?id=29032 "Request #29032: Release with PHP 8.4 support (Sam Reed, 2025-03-07)"
Resolves: pear#20 "MSGH Pear Net_URL2 pear#20: URL2.php remove executable bit (Sam Reed, 2025-02-28)"
Resolves: pear#18 "MSGH Pear Net_URL2 pear#18: Restore Phpunit Tests (Tom Klingenberg, 2025-02-12)"
Resolves: pear#17 "MSGH Pear Net_URL2 pear#17: Fix _encodeData regexp (Andreas Kurth, 2025-02-09)"
Resolves: https://pear.php.net/bugs/bug.php?id=28662 "Request #28662: Minimum supported PHP version? (Sam Reed, 2024-11-25)"
Resolves: pear#15 "MSGH Pear Net_URL2 pear#15: Update CI to GitHub Actions (Sam Reed, 2024-11-25)"
Resolves: pear#14 "MSGH Pear Net_URL2 pear#14: URL2: Fix implicit null declaration (Sam Reed, 2024-11-25)"
Resolves: https://pear.php.net/bugs/bug.php?id=28649 "Bug #28649: PHP 8.4 compatybility bug" (Aleksander Machniak, 2024-08-30)
Resolves: pear#13 "MSGH Pear Net_URL2 pear#13: Add .gitattributes to exclude dev files from Composer package (Timo Tijhof, 2020-02-15)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants