8000 Make tests compatible with newer phpunit versions by williamdes · Pull Request #7727 · matomo-org/device-detector · GitHub 10BC0
[go: up one dir, main page]

Skip to content

Conversation

@williamdes
Copy link
Contributor
@williamdes williamdes commented Jul 2, 2024

Description:

  • Non breaking changes for newer phpunit versions (running on PHPUnit 11.1.3 at Debian)
  • Fixing the parameter names for newer PHP versions (Error: Unknown named parameter $check)
  • Upgrade GitHub actions
  • Allow newer PHPunit versions up to 12
  • Fix deprecations in tests

Review

@williamdes

This comment was marked as resolved.

@sgiehl
Copy link
Member
sgiehl commented Jul 2, 2024

Why should the variable name need to contain a _? What is the problem with useragent? This doesn't comply with our coding style.

@williamdes

This comment was marked as resolved.

@williamdes

This comment was marked as resolved.

@williamdes williamdes marked this pull request as draft July 17, 2024 10:41
@williamdes williamdes force-pushed the phpunit-upgrade branch 3 times, most recently from 76b7e67 to 7298a44 Compare July 17, 2024 11:19
@williamdes williamdes marked this pull request as ready for review July 17, 2024 11:19
@williamdes williamdes requested a review from sanchezzzhak July 17, 2024 11:20
@williamdes
Copy link
Contributor Author
williamdes commented Jul 17, 2024

Weird CI failures, new commits broke something or is it my diff ?

@liviuconcioiu
Copy link
Collaborator
liviuconcioiu commented Jul 17, 2024

Not sure, but probably the PHPUnit workflow should be updated too so it can use composer update? Now it tries to run PHPUnit 11 on PHP 7.2.

I installed PHP 7.2.5 (this is the lowest version required by symfony/yaml 5.1.7) and the tests pass.

@williamdes
Copy link
Contributor Author

Not sure, but probably the PHPUnit workflow should be updated too so it can use composer update? Now it tries to run PHPUnit 11 on PHP 7.2.

I installed PHP 7.2.5 (this is the lowest version required by symfony/yaml 5.1.7) and the tests pass.

Oh snap, let's revert that part. I only need the PHP diff anyway
PRs like #7570 can update that

@williamdes
Copy link
Contributor Author

I dropped the last commit, it should help

@liviuconcioiu
Copy link
Collaborator

@williamdes can you fix the conflicts? And also you should also add static to getFixturesDeviceTypeFromClientHints. It was added after your PR.

@williamdes williamdes force-pushed the phpunit-upgrade branch 2 times, most recently from fa38ec4 to 5ad901f Compare December 22, 2024 19:45
@williamdes
Copy link
Contributor Author

I did some ajustements as I am quite sure the ignore should not have been used for all versions and this way.

@sanchezzzhak
Copy link
Collaborator

Run local php vendor/bin/phpcbf for fix phpcs

@williamdes

This comment was marked as resolved.

@liviuconcioiu
Copy link
Collaborator

@williamdes is it possible to update the workflow so it does look like this?

ok

Right now it looks like this:

notok

Those are missing (pending but aren't running):

PHPUnit (windows-latest, 8.4)
PHPUnit (macos-latest, 8.4)

2

@williamdes
Copy link
Contributor Author
williamdes commented Apr 12, 2025

@williamdes is it possible to update the workflow so it does look like this?

Not really (I have no options to change the text), can it be merged as is @sgiehl ?
I have one more PR for phpunit 12 afterwards

@williamdes
Copy link
Contributor Author

Hi @sgiehl
Can you check this one please ?

@williamdes

This comment was marked as resolved.

@liviuconcioiu
Copy link
Collaborator
  1. You should run ./vendor/bin/phpcbf to fix the phpcs errors - https://github.com/matomo-org/device-detector/actions/runs/20045151285/job/57507861303?pr=7727

  2. You can add to composer, so we get rid of scrapbook deprecations

        "psr/cache": "^1.0.1 || ^2.0 || ^3.0",
        "psr/simple-cache": "^1.0.1 || ^2.0 || ^3.0",
Lock file operations: 0 installs, 3 updates, 0 removals
  - Upgrading matthiasmullie/scrapbook (1.4.9 => 1.5.4)
  - Upgrading psr/cache (1.0.1 => 3.0.0)
  - Upgrading psr/simple-cache (1.0.1 => 3.0.0)
  1. On PHP 8.5 there are some deprecations - https://github.com/matomo-org/device-detector/actions/runs/20045151287/job/57507861394?pr=7727
3) E:\GitHub\device-detector\Tests\Parser\Client\BrowserTest.php:118
Method ReflectionProperty::setAccessible() is deprecated since 8.5, as it has no effect

4) E:\GitHub\device-detector\Tests\Parser\Client\BrowserTest.php:122
Method ReflectionProperty::setAccessible() is deprecated since 8.5, as it has no effect

5) E:\GitHub\device-detector\Tests\Parser\Client\BrowserTest.php:145
Method ReflectionMethod::setAccessible() is deprecated since 8.5, as it has no effect

Probably is a good idea to add this

if (PHP_VERSION_ID < 80500) {
    $browserProperty->setAccessible(true);
}

@williamdes
Copy link
Contributor Author
williamdes commented Dec 9, 2025

Thank you @liviuconcioiu !
Can someone approve the workflows ?

Edit: phpcs is fixed, all will go green now

@sanchezzzhak
Copy link
Collaborator

The tests are completed.
The code has been verified.
Everything looks good, I'm combining it.
Thank you all for involved.

@sanchezzzhak sanchezzzhak enabled auto-merge (squash) December 15, 2025 09:59
@sanchezzzhak sanchezzzhak merged commit 31a4c59 into matomo-org:master Dec 15, 2025
19 checks passed
@williamdes williamdes deleted the phpunit-upgrade branch December 17, 2025 08:56
@williamdes
Copy link
Contributor Author

Can you tag a new release some time soon so I can import the version into Debian?

@liviuconcioiu
Copy link
Collaborator

Can you tag a new release some time soon so I can import the version into Debian?

@williamdes a new version has just been released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

0